This.props.dispatch not a function – React-Redux

Per the Redux FAQ question at herethis.props.dispatch is available by default if you do not supply your own mapDispatchToProps function. If you do supply a mapDispatchToProps function, you are responsible for returning a prop named dispatch yourself:

const mapDispatchToProps = dispatch => ({
   ...other methods,
   dispatch                // ← Add this
})

export default connect(null, mapDispatchToProps)(Component)

Or, you can make sure your action creators are pre-bound using Redux’s bindActionCreators utility, and skip having to worry about using this.props.dispatch in your component.

Leave a Comment