Member-only story
React State — Eligibility Rules
Jun 18, 2023
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