diff --git a/src/index.ts b/src/index.ts index 3b5b9ef..b2368a5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -10,8 +10,8 @@ export function useZustand( const state = store.getState(); const [[sliceFromReducer, storeFromReducer], rerender] = useReducer< Reducer< - readonly [Slice, StoreApi, State], - readonly [Slice, StoreApi, State] | undefined + [Slice, StoreApi, State], + [Slice, StoreApi, State] | undefined >, undefined >( @@ -25,6 +25,7 @@ export function useZustand( } const nextSlice = selector(nextState); if (areEqual(prev[0], nextSlice) && prev[1] === store) { + prev[2] = nextState; return prev; } return [nextSlice, store, nextState];