Member-only story

React State — Eligibility Rules

--

For us to make it as state variable in React components (Both functional with useState and class with this.state), it should be passing the below conditions

Eligibility Rules

  • Value should change over the time
  • Value cannot be computed by any other state or props

Examples

Value should change over the time

  • Input values (textbox, checkbox, select, radio , etc.,)
  • Values from network API calls

Value cannot be computed by any other state or props

  • Counter values, which is incremented from its own value
  • Toggle Flags

--

--

Vinodh Thangavel
Vinodh Thangavel

Written by Vinodh Thangavel

Passionate lifelong learner, coding enthusiast, and dedicated mentor. My journey in tech is driven by curiosity, creativity, and a love for sharing knowledge.

No responses yet