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
Yes you can with ternaru operator, which evaluates the left side as boolean and if true it executes the right side or the fallback.
canClick ? this.handler() : () => false }>hello
https://stackblitz.com/edit/react-uwzn4n