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.
Solution - React.js Tutorial
From the course: React for Web Designers
Solution
(upbeat music) - [Instructor] Here's my solution to the color selector challenge. The goal is to activate the color selector so that it causes changes in the available list of sizes and optionally, to update the selected size piece of state based on that availability check. So if I change the color from red to green, I can see that the shoe changes color. And my list of sizes is shrinking. Now if I start changing things over here, I'm starting to paint myself into a corner a little bit where some of the colors are disappearing, and some of the sizes are disappearing as well. We could add a react powered reset button to fix all this. We don't have it right now, so I'll just reload. I also said to watch out for weird behavior, and of course, paint ourselves into a corner like that was one piece of weird behavior, but here's another one. If I keep the color red and go to size 12, say, the picture shows a brown shoe but the currently selected color is green. We're going to look at why…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Installing React on an existing site8m 7s
-
(Locked)
Identifying your components and data3m 19s
-
(Locked)
Set up first simple component5m 31s
-
(Locked)
Start using JSX with the help of Babel7m 57s
-
(Locked)
Attaching a data source3m 20s
-
(Locked)
Create a new component with array data5m 56s
-
(Locked)
Implement props4m 28s
-
(Locked)
Implement state with the useState hook5m 11s
-
(Locked)
Add the color selector component3m 27s
-
(Locked)
Change options, see reactions6m 14s
-
(Locked)
Challenge: Activate the color selector1m 58s
-
(Locked)
Solution3m 4s
-
(Locked)
-
-
-