I am using twbs:bootstrap@=4.0.0-alpha2 with react. I tried to call a child button component from its parent
parent:
<StandardBtn type="button" className="btn btn-success-outline pull-right" onClick={()=>{console.log("hello2")}} text={"Register"}/>
child:
export default class StandardBtn extends Component { render() { let props=this.props; return ( <button type={props.type} className={props.className} onClick={()={props.onClick}}> {props.text} </button> ) } }
When I clicked on the button, the console show: Uncaught ReferenceError: onClick is not defined
However, if i do the same thing( define the button and its onClick callback) on the parent level, there is not err.
I’ve also tied to bind env to callback in the child, but it has the same error
Any help is appreciated