getDispatch should return all dispatch functions.
See original GitHub issueHey there,
I’m in the process of porting my app from Reactn 1.0 to 2.0. Now I run into trouble when I’m rendering, for example, a list of components in a separate (nested) function, where I want to use a reducer in the nested function. I.e.:
return (
<SomeComponent>
{renderChildComponentsWhereIUseReducers()}
</SomeComponent>
)
I used to be able to just use getGlobal()[reducerName] to get a reference to one of my reducers, but in 2.0 I can only find the useDispatch hook to do this with. Unfortunately, I run into errors when using hooks in nested functions…
Is there another way of retrieving a reducer that I’m not aware of?
I appreciate your time and help in this.
cheers,
Roland
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Connect: Dispatching Actions with mapDispatchToProps
The mapDispatchToProps function will be called with dispatch as the first argument. You will normally make use of this by returning new ...
Read more >How to get dispatch function reference and action creater as a ...
we get dispatch function ref in our connected component but when we use action creator argument in our connect function then it will...
Read more >4 ways to dispatch actions with Redux - Bam Tech
It's based on actions that are dispatched and listened by reducers which modify the state properly. If you're not familiar with the Redux ......
Read more >Different Ways to Dispatch Actions with Redux - Pluralsight
No single option is considered the best, as it fully depends on our use case. Let's look at the various ways to dispatch...
Read more >Calling store.dispatch() from a React component file? #916
Any component wrapped with connect() call will receive a dispatch function as a prop, and any state it needs from the global state....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you so much! And thanks for your work on reactn, I’m enjoying this library a lot!
This feature is added and will deploy with 2.0.1 soon. Probably today.