0

What is the difference between React State and Javascript objects? when the state changes the dom changes automatically and when objects change the dom is also changed.

2 Answers 2

1

React State IS a JavaScript object. The purpose is to keep track of changing information between renders.

The best part is that if you change the state inside a component, the virtual DOM will know which parts of the DOM need to be modified (instead of modify the whole DOM).

Sign up to request clarification or add additional context in comments.

Comments

0

In React , The state object is where you store property values that belongs to the component. React is a javascript library so it uses javascript object as its state. In short React state is a javascript object .

When there is any change in the state via the setState func , then the DOM re-renders only to the specific part that has changed. Beauty of react , the virtual Dom.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.