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.
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: