Context provides a way to pass data through the component tree without having to pass props down manually at every level.
pass data? is it actually passing data or is it just passing references to some object in the shared runtime?
props that are required by many components within an application
Context is primarily used when some data needs to be accessible by many components at different nesting levels.
so a prop might be required by a random selection of components in this tree. if it is just one component down somewhere, instead of using context to dereference props, an alternative design could have a constructed component, preconstructed with the aforementioned props, passed down as is.
Context provides a way to share
values like these between components without having to explicitly pass a prop through every level of the tree.
data that can be considered “global” for a tree of React components
an initial context is created and wrapped around components that need to dereference values from it
can more than one component tree, be wrapped in a context?
what if the context is mutated in place? will the changes propagate? or is this idea, an antipattern?
Context lets you “broadcast” such data, and changes to it, to all components below.
All consumers that are descendants of a Provider will re-render whenever the Provider’s value prop changes.
pass data? is it actually passing data or is it just passing references to some object in the shared runtime?
so a prop might be required by a random selection of components in this tree. if it is just one component down somewhere, instead of using context to dereference props, an alternative design could have a constructed component, preconstructed with the aforementioned props, passed down as is.
an initial context is created and wrapped around components that need to dereference values from it