You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the current API of this library, you must return the "internal" structure of the store:
useReducerWithSideEffects(reducer,initialState,()=>{return{state: {someState: true},sideEffects: []// you also must include this or else an uncaught exception will occur};})
Users are unable to use Update/UpdateWithSideEffects/etc., because those don't return the correct key: they return newState rather than state.
I suggest refactoring Update/etc. to internally use the key state instead. That way, users of init can use a consistent API with this lib:
When using
useReducer
, init returns the state:With the current API of this library, you must return the "internal" structure of the store:
Users are unable to use
Update
/UpdateWithSideEffects
/etc., because those don't return the correct key: they returnnewState
rather thanstate
.I suggest refactoring
Update
/etc. to internally use the keystate
instead. That way, users ofinit
can use a consistent API with this lib:This change could even be released as a bug fix, I think, since it only changes non-public structures.
I'm curious to hear your thoughts on this @conorhastings !
The text was updated successfully, but these errors were encountered: