Table of Contents

About

state in design

Set is the minimum set of variable that defines the state of an block or app.

State allows an application to change their output (console or UI) over time in response to user actions, network responses, and anything else.

State is generally reserved for interactivity.

State is generally what must be saved in order to be able to restore the visual or behavior of an application (or components) after restart.

Example

Example:

  • On/Off
  • Color

For example, if you're building a TODO list, just keep an array of the TODO items around; don't keep a separate state variable for the count. Instead, when you want to render the TODO count, simply take the length of the TODO items array.

Rules

If the answer to the below question is yes, it probably isn't state.

  • Does it remain unchanged over time?
  • Can you compute it based on any other state ?

A strategy to achieve no inconsistent state.: Make sure that everything that can be derived from the application state, will be derived automatically (Mobx)