DEV Community

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

Posted on

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❤