3 ms·
You can have both local and global state. That checkbox sounds like it should be handled locally. However, if it's part of a bigger scope (e.g. a form) I would
by Kiro 3y ago
You can have both local and global state. That checkbox sounds like it should be handled locally. However, if it's part of a bigger scope (e.g. a form) I would still put the state somewhere central, like in a form context or even in the global store. It's not unthinkable that another part of the form may affect or want to read the checkbox state in the future. You would probably also want to bootstrap the form with previous data when editing, which becomes trivial if it just listens to a big state tree representing the form instead of manually passing default props to the component.
And no, you don't need to to prop drilling when using contexts or a state manager.