Skip to content

Commit

Permalink
feat(useSafeState): fix issue with inability to set state before mount
Browse files Browse the repository at this point in the history
  • Loading branch information
xobotyi committed Jun 30, 2022
1 parent a63188a commit af8f4cd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/useSafeState/useSafeState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function useSafeState<S>(
initialState?: S | (() => S)
): [S | undefined, Dispatch<SetStateAction<S>>] {
const [state, setState] = useState(initialState);
const isMounted = useIsMounted();
const isMounted = useIsMounted(true);

return [
state,
Expand Down

0 comments on commit af8f4cd

Please sign in to comment.