From the course: Building Production-Ready React Apps: Setup to Deployment with Firebase
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Pass props to child components
From the course: Building Production-Ready React Apps: Setup to Deployment with Firebase
Pass props to child components
- [Instructor] React components use props to communicate with each other. Every parent component can pass data to a child component by using the props. Props are the same as attributes to HTML elements. For example below, we have this component Welcome with a prop to pass the data of Sara, the string object. And inside this component, we can then read and access this information via the props. So the goal in our example is to do the same, passing data from the parents to a child component, and then be able to read the information from the component, the child components. Because here the goal is not to read and repeat the same static content, we want to be able to display actual images in this gallery instead of just a placeholder image. So for this example, for your convenience, I am providing with a collection of placeholder images that I took from this website, picsum.photos. So we're going to copy this array. And back…
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
-
-
-
-
Add Bootstrap 5 to your single-page application5m 1s
-
(Locked)
Build a responsive layout with Bootstrap 54m 59s
-
(Locked)
Build the UI and create reusable components5m 21s
-
(Locked)
Pass props to child components2m 42s
-
(Locked)
Challenge: Thinking in React1m 32s
-
(Locked)
Solution: Breaking up the UI4m 41s
-
-
-
-
-
-
-
-
-
-
-