skip to Main Content

Reactjs – How does a Component takes a function as its child?

I saw code like this: export const ProModeContext = React.createContext({ proMode: false }) export class ActionButton extends Component { render() { return ( <ProModeContext.Consumer> {contextData => <button disabled={!contextData.proMode} onClick={this.props.callback}> {this.props.text} </button> } </ProModeContext.Consumer> ) } } I alway think we…

VIEW QUESTION
Back To Top
Search