3 ms·
You populate redux with all the data your app needs (if you're using setState to store state fetched from APIs on components, stop). Then you simply render your
by faceyspacey 10y ago
You populate redux with all the data your app needs (if you're using setState to store state fetched from APIs on components, stop). Then you simply render your app in one go.
- idbehold 10y agoOkay, let's say I put the actual fetch() inside a redux "action creator" how am I fetching that data server-side? How does some arbitrary route know that a nested component needs to fetch() and then populate your store before rendering? And remember, the fetch() in the "action creator" is still trying to hit a relative route.
- faceyspacey 10y agoyou call the action creator and dispatch its results to you redux store before rendering. For "arbitrary" routes, you design your application in a way that just by the pathname, query parameters, etc, you know exactly what data to get for the whole component tree. ..Don't use a relative route.
- idbehold 10y ago> For "arbitrary" routes, you design your application in a way that just by the pathname, query parameters, etc, you know exactly what data to get for the whole component tree. That entirely defeats the purpose of an isomorphic/universal React application.
- deleted 10y ago[deleted]