Atoms
Atoms in Elegance refer to single units of reactive state.
You can create one either within a component or by using the state function to create global a global atom.
Reactivity
Reactivity is achieved through measuring readers of an atom.
When within the view method of a component you read the value property of an atom; you implicitly subscribe to it.
Whenever you set the value property of an atom, you trigger the re-render and clear the subscribers.
Track and Untrack
There are also two provided helper functions. track and untrack, which accept an atom, and a callback. callback will then be called whenever atom changes it's value. track returns a callbackId which you should use to untrack the atom.
Important Caveats
Currently an atoms value before it is shipped to the browser must be serializable into JSON. This means that functions, classes, etc, are not valid atom values.
It might also be in your interest to keep atom values minimal, so if you read something like a JSON blob on the server, unless you need the full blob in the client, you might want to not store it in an atom, or if you do, clear it.