Interactivity, State, and Hooks
At this point, React has taken over part of our page and is drawing the seats (although if youâve looked at the before and after, youâll see that it was color-coding used tickets and itâs not anymore, weâll bring that back in Chapter 11, âManaging State in Reactâ). This is nice enough, but weâd like it to, you know, react to something. Weâd like to have a little interactivity.
In React, you can use JSX to specify event handlers on React elements in much the same way you would when writing old-school JavaScript embedded in HTML. The problem is how to make changes to our components as a result of those events. As mentioned, the props we pass into each component are immutable, which means if we want ...
Get Modern Front-End Development for Rails, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.