From the course: React for Web Designers

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Change options, see reactions

Change options, see reactions - React.js Tutorial

From the course: React for Web Designers

Change options, see reactions

- Now we have all of our components in place. But if we make a selection, nothing changes. The list of five colors is the same, no matter what size I select. And if I change the color, the shoe doesn't change, the sizes don't change, nothing changes. So we need to make some changes to our code, so that these events that fire in the browser, actually make some updates on the page. We're going to do that for the first time in this video, wiring up this size selector to update the list of colors that are available in that size. So over here in my code, we need to wire something up to this select box. Specifically, we need to listen for the change event. And to do that on React, we set a prop called onChange. These are just like the inline event handlers that you see in regular HTML and JavaScript. In React, they just need to be in camel case. React has pretty much all the same event handlers that the DOM API offers with very, very rare exceptions. So if you can remember what it was…

Contents