This concept is when you're passing the data from the parent down to its direct children.
Take for example the image above where the App component has 2 children, the Modal component and the Form component. The App component has the following data.
How do we then pass the data down from App to Form component? That's when we're going to use "props". Props consists of all attributes that we pass the component to. What do I mean by that? Let's have a look at the example below:
Props is a shortened version for properties, quite similar to objects, each component have their own properties "IF" given any. If we were to convert the code above to a vanilla Javascript object, it will look like this:
Now let's have a look at our JSX code and identify the attributes.
As you've noticed, we have an attribute property and a value assigned to each attribute. Quite similar to how objects are.
Top comments (0)