Understanding a React context

A React context is a way to pass data through the component tree without passing it through component props. A context is created and provided at the appropriate place in the component tree for other components lower in the tree to consume:

The preceding diagram shows several components in a tree. A context called FormContext has been created and provided within the Form component via the Provider component within FormContextEvery component beneath FormContext.Provider in the component tree can consume FormContext via the Consumer component within FormContext. Components A, B, C, D, E, and F cannot consume FormContext because they are not beneath FormContext.Provider.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.54.7