We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 992be42 commit 5b19d05Copy full SHA for 5b19d05
index.ts
@@ -13,7 +13,7 @@ type UseStateRef = {
13
<S = undefined>(): UseStateRefValue<S>;
14
};
15
16
-const useStateRef: UseStateRef = <S>(initialState?: S | (() => S)): UseStateRefValue<S> => {
+const useStateRef: UseStateRef = <S>(initialState?: S | (() => S)) => {
17
const [state, setState] = useState(initialState);
18
const ref = useRef(state);
19
@@ -23,7 +23,7 @@ const useStateRef: UseStateRef = <S>(initialState?: S | (() => S)): UseStateRefV
23
setState(ref.current);
24
}, []);
25
26
- return [state, dispatch, ref];
+ return [state, dispatch, ref] as UseStateRefValue<S>;
27
28
29
export = useStateRef;
0 commit comments