Skip to content

Commit

Permalink
fix fromSelf always being truthy
Browse files Browse the repository at this point in the history
  • Loading branch information
itswillta committed Aug 18, 2024
1 parent e6a18ee commit 7a40c64
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export function useZustand<State, Slice>(
() => [slice, store],
);
useEffect(() => {
const unsubscribe = store.subscribe(rerender as DispatchWithoutAction);
(rerender as DispatchWithoutAction)();
const unsubscribe = store.subscribe(() => rerender());
rerender();
return unsubscribe;
}, [store]);
if (storeFromReducer !== store) {
Expand Down

0 comments on commit 7a40c64

Please sign in to comment.