I got somthing like this on React?
$(document).on("click", function (e) { ... }
Or is mandatory to use onClick on all components?
I got somthing like this on React?
$(document).on("click", function (e) { ... }
Or is mandatory to use onClick on all components?
2
Answers
It is not a good practice and You should try and avoid jQuery in ReactJS, But:
You can have that, but in order to do that you need to add your code in the right life cycle hook
for example, you can do this
In a class component you can add your code in componentDidMount