1 context
2 contextType
3 lazy
4 suspense
5 memo
===========
1 Context provides a way to allow data transfer without a manual transmission in a tree assembly
API: createContext(defaultValue)
Example 1:
React Import, the Component {,} from the createContext 'REACT'; // here function derived context Import logo from './logo.svg' ; Import './App.css' ; const BatteryContext = the createContext (); // in Create a context where // grandchildren component class the extends the component {Leaf the render () { // defined here consumer consumer return ( <BatteryContext.Consumer> { Battery => <h1 of> BatteryName: Battery {} </ h1 of> } </ BatteryContext.Consumer> ) } } // subassembly {Middle the extends the Component class the render () { return <Leaf />; } } // parent element class the extends the Component {the App the render () { // defined here Provider context provider return ( <60 BatteryContext.Provider value = { }> <Middle /> </BatteryContext.Provider> ) } } Export default the App;