redux-universal
redux-universal copied to clipboard
Data fetching in onEnter
As react-router's author say, onEnter
should only use for redirect, see: https://github.com/rackt/react-router/issues/1389#issuecomment-146075183
Any ideas here?
@chentsulin
If you don't mind waiting for your data to load before you transition, you can use onEnter to fetch data. But your page will feel sluggish because the router doesn't attempt to update state until all onEnter hooks are finished (so it knows if it needs to redirect or not).
They suggest it shouldn't be used, but in our case since we are using it for server side render, does it matter that the page feels sluggish? What do you think?
Do they suggest any replacement for onEnter
on pure client side? or there's other suggested approaches to handle async data loading (on the client) in the new router?
As to the server rendering, I'm 100% with you here.
Any updates? I found this https://github.com/emmenko/redux-react-router-async-example Not sure if I like this solution