npm.io
1.0.1 • Published 2 years ago

@cooperbuckingham/one-pass-global-state

Licence
MIT
Version
1.0.1
Deps
3
Size
20 kB
Vulns
0
Weekly
0

Simple Global State

Restrictive, typed, access to global state via hook and single key, for react

How to use

  • Call CbSimpleGlobalState.init(<initial global state>) to get the singleton instance of CbSimpleGlobalState;
  • use the useGlobalState hooks on the singleton to access global state
  • use the useLocalState hooks to handle local state
Note on Restrictions
  • To keep things simple and strongly typed, to focus on developer ease of use, there are only 7 tiers of nested typed global state.