Skip to content

Commit e121ca7

Browse files
authored
docs(react): fix useForceUpdate jsdoc (#206)
1 parent 6fcd8c3 commit e121ca7

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

packages/react/react/src/hooks/useForceUpdate.ts

+12-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,18 @@ const updater = (num: number): number => (num + 1) % 1_000_000;
77
* @description
88
* 반환된 함수를 실행 시 강제로 리렌더가 실행됩니다.
99
*
10-
* @note {@link https://github.com/streamich/react-use/pull/837 useReduce가 state보다 가볍다는 의견이 있습니다.}
10+
* @example
11+
* const forceUpdate = useForceUpdate();
12+
*
13+
* const set = useCallback(
14+
* (items: T[]) => {
15+
* listRef.current = items;
16+
* forceUpdate();
17+
* },
18+
* [forceUpdate]
19+
* );
20+
*
21+
* @note {@link https://github.com/streamich/react-use/pull/837 useReducer가 state보다 가볍다는 의견이 있습니다.}
1122
*/
1223
export function useForceUpdate(): () => void {
1324
const [, forceUpdate] = useReducer(updater, 0);

0 commit comments

Comments
 (0)