question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

getDispatch should return all dispatch functions.

See original GitHub issue

Hey 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:closed
  • Created 4 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
rolandzwagacommented, May 15, 2019

Thank you so much! And thanks for your work on reactn, I’m enjoying this library a lot!

1reaction
CharlesStovercommented, May 15, 2019

This feature is added and will deploy with 2.0.1 soon. Probably today.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found