đĨ Events
How to handle events in JSX
Events in Vanilla JS
const button = document.querySelector('button');
button.addEventListener('click', (event) => {
console.log(event);
})
Events in React
function Events() {
return <button onClick={(event => console.log(event))}>Click</button>
}
Challenge
Implement a text input that updates the input value and logs the event target.