DEV Community

Cover image for Adventofcode 🎄 : Day 3 - State and Props
Jemima M
Jemima M

Posted on

Adventofcode 🎄 : Day 3 - State and Props

Happy 3rd of December! Our revision today are states and props. Let's begin...

What are State and Props in React?

In React, props serve as a way to transmit data or properties from one component to others, facilitating effective communication between different parts of your application. On the other hand, the state embodies real-time data exclusive to the confines of a specific component, offering a dynamic and self-contained source of information.

States and props serve as fundamental cornerstones in React, playing a central role in shaping the framework's core functionality. Virtually every aspect of React development relies on the utilisation of these two concepts, making them essential elements in making robust and responsive user interfaces.

So, a state is used for mutable data within a component, while props are used for passing data from a parent to a child component.

Definitions:

Parent Component: A parent component is one that contains and manages another component, referred to as its child. It sits higher in the component tree.

Child Component: A child component is nested within a parent component. It exists at a lower level in the component tree.

I hope that this short revision has helped!
In the meantime....KEEP CODING!!

Top comments (0)