Skip to content

Commit 2a0127e

Browse files
committed
refactor: useShallowState 명시
1 parent 501a59f commit 2a0127e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/lib/src/hooks/useShallowState.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ export const useShallowState = <T>(initialValue: T | (() => T)): [T, (newValue:
66

77
const setShallowState = useCallback((newValue: T) => {
88
setState((prevState) => {
9-
if (!shallowEquals(prevState, newValue)) return newValue;
10-
return prevState;
9+
if (shallowEquals(prevState, newValue)) return prevState;
10+
else return newValue;
1111
});
1212
}, []);
1313

0 commit comments

Comments
 (0)