I
I
Ignatiy22019-06-28 14:41:35
React
Ignatiy2, 2019-06-28 14:41:35

How to use connect to pass only the mapDispatchToProps function there?

I have a component that does not need to accept elements from the store, but needs to be added. And in connect, the mapDispatchToProps function is passed as the second argument, after mapStateToProps. I tried to just put mapDispatchToProps, but I got an error. Is it possible somehow not to write mapStateToProps?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2019-06-28
@Ignatiy2

connect(null, mapDispatchToProps)(MyComponent);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question