From the course: React for Web Designers

Unlock this course with a free trial

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

Implement props

Implement props

- [Instructor] In this video, we're going to implement props for the first time and see how that one way data flow happens at a basic level. So we've said that we need a top level customizer component to own the data, because the image needs to know the color of the sneaker, and of course, the color selector, when we eventually have one, is going to need to know that as well. So the state we care about will eventually come from the product customizer and be passed down to these child components as props. Anything a child component needs, state, callback functions, whatever, comes in as props. So switching back to the code, here's what we're going to do. We're going to pass in things that we need to these child components, from the product customizer. To start out, we're going to keep this super simple. We're just going to pass in some hard coded props. So for the product image, what we're going to need to know is what color to display. So let's set up a color prop, we'll just pass in…

Contents