What is the difference between React state and a regular JavaScript variable inside a functional component?

React Developer Medium

React Developer — Medium

What is the difference between React state and a regular JavaScript variable inside a functional component?

Key points

  • State in React components causes re-rendering upon update
  • Regular JavaScript variables do not trigger re-rendering
  • State helps maintain UI consistency with updated data

Ready to go further?

Related questions