Answer the question
In order to leave comments, you need to log in
Store pre-population strategy in isomorphic flux apps?
Tell us how you fill the stores in isomorphic flux apps.
If on the client we can request data after the component is thrown into the DOM. Then on the server, the store needs to be filled with data before the component is rendered. HigherOrderComponents
A common technique: a static method (for example) is hung on the parent classes ( fetchData
), initiating a request to the API and filling the stores. It starts and runs before react starts rendering the app.
<App>
<SomeItemsHigherOrderComponent> // <----- has static method `fetchData`
<SomeItems ... />
</SomeItemsHigherOrderComponent>
<OtherItemsHigherOrderComponent> // <----- has static method `fetchData`
<OtherItems ... />
</OtherItemsHigherOrderComponent>
</App>
fetchData
only the component that we are currently rendering? That is, why not take only the data that is required to display the current page? If the user wants to go to the next one, make the next request. Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question