Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discussion: Can a store be initiated before Rendering? #2217

Closed
nunomago opened this issue Aug 11, 2017 · 4 comments
Closed

Discussion: Can a store be initiated before Rendering? #2217

nunomago opened this issue Aug 11, 2017 · 4 comments

Comments

@nunomago
Copy link

Trying to upgrade to v4 we stumbled upon issue #2170 where you mention rasmniel/rnrfSample as a good starting point and modify that example.

One thing we got stuck on is the comment it is important to load reducers AFTER actions.create (so no import here) which confuses us.

Will this not have a detrimental effect on app performance if we are forced to go all the way to rendering before we initiate reducers? A lot of rendering in our apps rely on data being fetched so that we can know what to display. Either locally or through the network it's going to be async and take time.

Is this the correct way to do it with v4 or is the author of the rnrfSample wrong? Can we continue to initiate the store before defining a ReduxRouter with it's corresponding Scene structures?

@aksonov
Copy link
Owner

aksonov commented Aug 11, 2017

As far as I know when you are using Actions.create, no render happens (correct me if I'm wrong) - you just create appropriated navigator. Rendering will happen only when you are use that navigator within render (what Router does). So I don't see any bad effect on app performance.

@nunomago
Copy link
Author

Can you explain to us the reason why this needs to be initiated in this order? We're having a hard time grasping how to the upgrade.

The performance part was just a gut reaction.

@aksonov
Copy link
Owner

aksonov commented Aug 11, 2017

Okey, v3 didn't have real two-way support of redux - i.e. you were able just to subscribe to nav events. If it is your way you don't need to change anything - check Example project, it works in the same way as with v3.

v4 introduced real two-way support of redux - it means you can change nav state from your reducers now. But to calculate initial navigation state for reducer, it is necessary to process all your scenes first - that is why you need to declare reducers/store after scene processing.

@nunomago
Copy link
Author

Thanks for the explanation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants