context

Context

Convenient parting delivery data

// Create a Context object const mycontext = React.createContext ()
// subcomponents need to use the Provider package <mycontext.provider value = {this.State.username}> <b /> </mycontext.provider>
// sub-component can accept this content // First method // declared receiving static contextType = MyContext <h2> {this.context} </ h2> // 2 method, can be used for functional components<Consumer> {value => {return `$ {Value}`}} </ consumer>