Stores
Dependency-injected state that descendants can read and write.
A store is a *StateValue[T] made available to every descendant component
in a subtree. It replaces prop drilling for values that many views need to
observe.
Defining a key
Define a *StoreKey[T] at package level. The pointer itself is the identity;
two keys with the same Default but different allocations are different
stores.
Providing
Provide attaches an initial value for the key onto the given scope. Only
descendant components (and the providing scope itself) can see it.
The typical place to call Provide is the root component:
If the same key is provided again by a descendant, the descendant shadows the ancestor within its subtree.
Reading
UseStore walks the scope tree for the nearest provider of the key and
returns its *StateValue[T]. If no ancestor provided the store, a fresh
state value is allocated at the current scope using the key's Default.
Because the returned value is the same *StateValue that the provider
stored, any Set or Update on it triggers a re-render in all subscribed
components, not just the one that called UseStore.