3 ms·
I'm fairly new to react, and have wondered if I was using it correctly (as intended). Almost always I have a root component that manages state, passing it to ch
by aaronkrolik 11y ago
I'm fairly new to react, and have wondered if I was using it correctly (as intended). Almost always I have a root component that manages state, passing it to children via props. All changes to state go through that root component, either by callback (also passed as prop) or some external event.
Is this update in a sense validation of that approach?
- epmatsw 11y agoWhat you've described is pretty similar to Flux or one of its variants. The main difference would be that instead of managing state inside of the root component via setState, you have an external state ("store"), which would handle the state logic and provide the appropriate values as props to the root component. So yes, it sounds like you're doing it "right".