Events How to handle events in JSX

This lesson is available for PRO members or as a single course purchase. Sign-in and choose a plan below.

Events in Vanilla JS

file_type_js_official 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?

Ask questions via GitHub below OR chat on Slack #questions