I would like to ask a question about event handlers when used in HTML and React.
In the book Javascript and Jquery written by Jon Duckett, the author mentioned that using HTML event handler attribute is considered bad practice for instance something like the following:
<button onClick="hide()">click me</button>
But recently I am starting to learn React and when a component is defined, there are many examples of event handlers used as an attribute and it seems common to do so, not getting criticism for doing so,
<button onClick={doSomething}>
xxxyyyzzz
</button>
Is there a reason to this? is it because this is the only way to bind a event handler in React?, from the way I see it React is essentially building the component element via HTML but uses the event handler attribute to assign an event to it, so why is React bringing back a concept that is considered bad practice?