M
M
Mary Solar2017-07-02 15:26:32
React
Mary Solar, 2017-07-02 15:26:32

State in react - what are you?

Colleagues, good afternoon. I'm reading the react documentation and still can't figure out what the state of a component means? With props, everything is clear - in them we can store the properties of the component and pass it as attributes. Trained, everything is clear.
What does state do? I understand that this is the state of the component, but what does it mean? What is it for?
If there is any blonde example for completely stupid blondes, please explain. You can explain on dogs and cats, I will be glad!
Thank you all for your help and understanding!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
rhost, 2017-07-02
@hoOstel

State - in it we can store the properties of the component and they will be visible only to the component.
https://codepen.io/anon/pen/MoVGxV

V
Vahe, 2017-07-04
@vahe_2000

The state object describes the internal state of the component, it is similar to props except that the state is defined within the component and is only accessible from within the component.
If props represents inputs that are passed to the component from the outside, then the state stores such objects that are created in the component and completely depend on the component.
Also, unlike props, values ​​in state can be changed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question