DEV Community

Shreyansi Shrestha
Shreyansi Shrestha

Posted on

{ Understanding PROPS in React.js }

PROPS meaning properties in React.js, and these properties/property can be passed from one component to another component ( for example : a property passed from parent component to the child component).

  • These properties are read-only.
  • Through these, parent component can send data to child component.

Image description

As we can we in the above picture, App.jsx is the parent component and Student.jsx is the child component. The key-value pair (name="Spongebob") from parent component is being passed to child component 'Student', and then that key value pair gets stored in PROPS object.

Now, to have the value of name from PROPS object, we use props.name and that is what we can see is done in the child component Student. So, this way we can retrieve value in child component from parent component ( via PROPS object).

In App.jsx :

Image description

In Student.jsx :

Image description

In localhost :

Image description

So, this is a topic in React.js that took me quite some time to understand and grasp the concept, but at the end, the satistaction of finally understanding it made all that effort worth it.

Billboard image

The fastest way to detect downtimes

Join Vercel, CrowdStrike, and thousands of other teams that trust Checkly to streamline monitoring.

Get started now

Top comments (0)

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay