A
A
albertalexandrov2018-11-23 09:18:16
React
albertalexandrov, 2018-11-23 09:18:16

How did dispatch end up in props?

Hello everyone!)
Please tell me how here https://redux.js.org/advanced/exampleredditapi#con... the dispatch() function was available via this.props.dispatch()? I suppose in mapStateToProps somehow implicitly ..

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
polarlord, 2018-11-23
@albertalexandrov

Because in this example, mapDispatchToProps() is not passed to connect(), and by default its value is dispatch => ({ dispatch })
You can read more in off. doc https://react-redux.js.org/docs/api#arguments or here https://stackoverflow.com/questions/34458261/how-t...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question