When to use state and where is it important to use it!

Andrew Pellum
1 min readAug 2, 2021

React is an awesome tool and can make your vanilla Javascript turn into something easier to use!

What is state?

The heart of every React component is its “state”, an object that determines how that component renders & behaves. In other words, “state” is what allows you to create components that are dynamic and interactive.

State makes React dynamic and allows apps like Facebook to become the incredible apps that they have evolved into!

How do you update state?

First, you will need to use the “useState” hook. Next you can name the variable (include the state and set state inside brackets. On the other side of the equal sign, you can set the default state before it gets updated.

State can be passed down to other components through props.

In my React project I wanted to update rankings retroactively with a like button. When I did this, I was using state. I updated the state to change if one object received more likes than another.

Using React was so fun to be able to learn and build such dynamic apps.