import React,{createContext} from 'react'; import ReactDOM from 'react-dom'; let {Provider, Consumer} = createContext(); //统一状态管理 class ProviderComponent extends React.Component{ render(){ return ( {this.props.children} ) } } class Child extends React.Component{ render(){ return (
{(value)=>

{value}

}
) } } class App extends React.Component{ render(){ return (
) } } ReactDOM.render( , document.getElementById('root'));