Guest User

Untitled

a guest
Jul 16th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. import React, { Component } from 'react'
  2. import IssueListItem from '../../components/issues/issue-list-item'
  3. import { connect } from 'react-redux'
  4.  
  5. import { map } from 'lodash'
  6. import { fetchIssues } from '../actions'
  7.  
  8. class IssueList extends Component {
  9. componentDidMount() {
  10. // Sorunları çeken action ı çağırıyorum
  11. this.props.fetchIssues()
  12. }
  13.  
  14. render() {
  15. if (!this.props.issues) return null
  16.  
  17. return (
  18. <div>
  19. <ul className="list-group">
  20. {map(this.props.issues, issue => {
  21. return <IssueListItem key={issue._id} issue={issue} />
  22. })}
  23. </ul>
  24.  
  25. {!this.props.loadingMore ? (
  26. <button
  27. style={{ marginTop: '20px', marginBottom: '30px' }}
  28. className="btn btn-primary btn-block"
  29. onClick={this.props.fetchMoreIssues}
  30. >
  31. Daha Fazla Yükle
  32. </button>
  33. ) : null}
  34. </div>
  35. )
  36. }
  37. }
  38.  
  39. function mapStateToProps({ issues }) {
  40. // Uygulama state indeki issues kısmını bu componentin props una bağlıyorum
  41. return { issues }
  42. }
  43.  
  44. export default connect(
  45. mapStateToProps,
  46. { fetchIssues }
  47. )(IssueList)
Add Comment
Please, Sign In to add comment