This combo will give you a simple state management pattern that can be used in any React application.
ContextState
type to include computed
values which you’ll compute using a useMemo
or inline in the Provider
. You can also add additional props to the Provider
to determine the initial state, remember to store these values for later use in the RESET
action.
Also also, rename these functions/types/files to be more specific to your use case. I’ve used State
and Actions
as generic names, but you should be more specific to your use case.