From the course: Build Modern Web Apps with React, Hooks, State Management, and APIs Using Vite or Next.js

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Understanding props

Understanding props

Hi and welcome to lesson number 3. In this lesson, we are going to see props and how we can pass data to components. Props is a short term for word properties. It's a mechanism for passing data from parent to child component. In the previous videos, we saw that we have an app.tsx component and we were calling other components from that component. In this example, app component was the parent component and the components that app component was calling were the child components. Props are immutable in nature for the receiving component. It means that you cannot change the value for this, they are read only. We can pass on props just like the html attributes. Here is an example of a welcome component that is receiving props. Over here we are calling the props.name which is one of the property of the props. And right below, you can see that the welcome component has been called. Over here, the name property has been passed and this is of type string. This component is usable in other…

Contents