I would like to know if it is possible to set onClick on a div element in react based on the value of a property in my case canClick.
onClick
canClick
I am awar
You can add Conditional Operator for this kind of purpose.
handler(){ } render() { const { canClick} = this.state return ( { (canClick) ? (clickble) : (not clickble) } ) }
Here is document example for that reactjs.org/docs/conditional-rendering