3 ms·
Okay, I get the idea. How are you solving these issues: - how is the data fetch completion signalled to the component? - how is the data piped into the compon
by yathaid 4y ago
Okay, I get the idea. How are you solving these issues:
- how is the data fetch completion signalled to the component?
- how is the data piped into the component?
Would be happy to be pointed to some example code if you have.
- MrPatan 4y ago> - how is the data fetch completion signalled to the component? > - how is the data piped into the component? Both have the same answer. When you fetch the data you put it in the state, and then you render your components based only on that state. If we're talking React the state makes it into the component through the props (pure UI component) or, if using Redux or similar, some kind of hook that triggers a rerender when the store changes (useSelector? My React-Redux is a bit rusty). The point is not to worry anymore about change detection and rendering, because the framework takes care of it by being either fast enough that it can run on every change, or smart enough that it can tell when it's not necessary to re-render (caching, change detection). Of course, this setup with redux etc makes a lot of sense for bigger apps with lots of state coming from different sources. I don't have any specific example I can point to, but any redux implementation examples could help. I use NgRx with Angular, and the docs are OK at explaining the flow of data.
- yathaid 4y agoThanks, this was useful.