Answer the question
In order to leave comments, you need to log in
How to pass a separate action in redux to mapDispatchToProps?
You need to pass an asynchronous action(redux-thunk) to the second argument of the connect function.
In the documentation I saw only examples of how to pass actions as an imported module, but I don’t understand how to pass them as a separate function
Answer the question
In order to leave comments, you need to log in
import { myAsyncAction } = this.props;
/ * ... * /
const mapDispatchToProps = {
myAsyncAction,
};
export default connect(mapStateToProps, myAsyncAction)(MyComponent);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question