đŸ’Ĩ Events

How to handle events in JSX

Events in Vanilla JS

file_type_js app.js
const button = document.querySelector('button');

button.addEventListener('click', (event) => {
    console.log(event);
})

Events in React

App.js
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.

Questions? Let's chat

Open Discord