An opinionated react hook to use reducers for local state

in a typesafe way

with an API like createSlice from redux-starter-kit

with immer integration

How to use it

;

and in some callback:

dispatchAction . concat ( " concatenate me! " ) ; dispatchAction . toUpper ( ) ;

use-local-slice provides one dispatchAction method per reducer, and (for typescript users) ensures that these dispatchers are only called with correct payload types.

Edge case uses & good to know stuff