First, run the development server:
npm run dev
- Local State (component-level, i.e., form state)
- keep within component
- example impl:
useState
- Module State (state composition between all components on a page)
- wrap entire page in state provider
- example impl:
ModuleStateProvider
- UI Alert State (alerts, modals, popups, toasters, tooltips)
- Dedicated state providers that tracks UI and status, i.e. JSX and 'open/close' boolean
- example impl:
useModal
,useToaster
,usePopup
, etc.,
- Entity State (data from remote source)
- fetch and cache client
- example impl:
urql
- Global State (not much after considering 1-4)
- user, menu, websockets, settings, notifications, store, etc.,
- example impl:
AppStateProvider
,redux library
, etc.,
- Wrap each page in own provider, application in provider
- Use UI hooks for all UI interactions
- Use
urql
for entity state
That's it.
- add to package.json scripts
"predev": "npm run generate",
- Menu, Tabs, Theme