Closed agg23 closed 4 years ago
Hi @agg23, appreciate the idea!
However, this package is intended to be a drop-in replacement for the native useReducer
hook. The idea is that it should behave exactly the same as useReducer
, just with thunk support. Although adding extra features to it would be trivial (and perhaps even useful), it's not in the spirit of what this package is built to be
There are non-dispatch scenarios where you need to grab the current value of state and waiting for it to propagate through props or context is not appropriate (say in a "save" callback). Since
useThunkReducer
already createsgetState
internally to expose to thunk functions, it would be trivial to exposegetState
alongside the current state anddispatch
.