React Events
If you have coded even a little bit in javascript, you know the importance of events.
Events
Every HTML attribute in React is written in camelCase syntax. Event is also an attribute. Hence, written in camelCase.
As we learnt variables, states, javascript operations are written in curly braces {}
, same is true with React event handlers too! Like this: onClick={show}
Arguments in events
We can't pass arguments just like that, it will give syntax error. First, we need to put the whole function in arrow function, like this:
React Event Object
Event handler can be provided to the function like this:
0 Comments