DEV Community

Cover image for State vs Props in ReactJs
Nausher Ali
Nausher Ali

Posted on

4 2

State vs Props in ReactJs

In short:
State are the variables by the component for the component.
Props are the variables. inherited by a component from its parent components.

State and props both do the same things. there are very few differences between them such as,
Props are immutable that is it returns same output every time for a particular input.
whereas state are mutable.
state can be also defined with the help of props.
this is what i have understand till now, any type of correction will be appreciated.

Top comments (4)

Collapse
 
devshams profile image
devshams

short and clear.

Collapse
 
nerdyaltafofficial profile image
nerdyaltafofficial

to the point, thanks.

Collapse
 
nausher_ali profile image
Nausher Ali

thanks for your appreciation

Collapse
 
techtobit profile image
Rifat

Most short but Powerful complite ans❤

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay