DEV Community

Discussion on: Explain State and Props Like I'm Five

Collapse
 
thobyv profile image
Thoby V ijishakin • Edited

Hi Gift. I'm glad to be able to help out.

State is Just Data. You know.. The usual data we see, share, use everyday.

In programming, we just kick around 2 things all our lives:

Data & Algorithms (you know..to manipulate data)

So just in case you're building a web based application. State is basically the data associated, down from usernames and JWT's to button-hover css classes.

Props is just more dynamic data ...this is more simpler than state to grasp, imagine you need to pass data(state) around from one house (function) to another to make use of it.

State isn't just associated with web components.

Games => Scores, health, Level, Position on screen of player etc.

Programming Languages => Function names, Object instances etc.

Human behavior => Emotions, Age, Portfolio etc.

Anything that holds information that can be changed/or not as well.