re: Explain State and Props Like I'm Five VIEW POST


I'd really welcome feedback if this isn't right or the best way of explaining them, but here's a shot:

State holds data and variables which are specific to a component. They work like object/class properties.

Props are options which you can pass into a component when you create them, often as an attribute, such as <Person eyes="brown"> - the prop is eyes, value is brown. You have to handle that in your component.


What is the difference between 'state' and an OOP object?


Hey David,

In my understanding, React and Vue state is an extension of an object, with some tools for noticing changes and informing the React or Vue framework about those changes so the framework/virtual machine can do something with those changes.

So state in react is a kind of object, but the inverse is not true (object is not a kind of state)

I hope this helps!


Very helpful, TY. Coming from a backend programming perspective and just recently learning VueJS state confused me a bit. Your explanation helps.


Thanks for breaking this down

Code of Conduct Report abuse