Docs

Everything You Need to Know

State

Intro

Data is the source of all truth in an app. You can use plain JavaScript objects, but State objects provide a powerful way to manage data. State objects offer features not available in plain JavaScript objects.

ChocolateChip-UI State can hold a single object of key value pairs, or an array of objects with key value pairs. When rendering, the components do not care whether the data is an object or an array of objects. The component examines the data of the State object. If its a single object, the component renders it. If the data is an array of objects, the component loops over the objects, rendering each one with its template.

State encapsulate your data so that it is only accessible through its interface. This protects your data from unintentional modification.

If you need to, you can pause a State object to make a bunch of changes, then unpause and force it to render its bound components. See the following section for how to do this.