DEV Community

Discussion on: React. The key points.

Collapse
 
konan792885 profile image
Milan Bogosavljevic

hi, i started react learning few days ago and have one question.
onclick="check()" i don't understand this, do you need brackets here?

Collapse
 
aberezkin profile image
Arkadii Berezkin

This example is for pure javascript and won't work with React. In React you handle click events with onClick not onclick and pass the function itself (not a function call) in the brackets. So in React it should look like onClick={check} but as I said it's pure javascript example. You can copypaste it in some *.html file and check that it works.