Skip to main content

Local State

You can define a dictionary using the following code that can contain objects that do not abide by the linear execution model of the notebook:
This example will create a button that increments a counter every time it is clicked. The counter will persist across runs while a normal counter variable would be reset on each run. These state objects will be local to each user of an app.

Global State

A global state dictionary is also available to be utilized that behaves similarly to the local state but is shared across all users. Here is an example:
Changes to this dictionary will not be broadcasted to all users but on subsequent runs the changes will be reflected in each user’s app.