Closed creamidea closed 7 years ago
When you use connect, please don't transfer mapDispatchToProps( the second optional param of connect), which overwrite this.props.dispatch in componentDidMount.
connect
mapDispatchToProps
this.props.dispatch
For example, the right way:
class ListContainer extends Component { constructor (props) { super(props) } componentDidMount () { const { dispatch } = this.props dispatch(fetchIssues(1, 25)) } render () { return <IssueList {...this.props} /> } } const VisibleIssueList = connect( mapStateToProps // please don't transfer the `mapDispatchToProps ` )(ListContainer)
When you use
connect
, please don't transfermapDispatchToProps
( the second optional param ofconnect
), which overwritethis.props.dispatch
in componentDidMount.For example, the right way: