We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6fcd8c3 commit e121ca7Copy full SHA for e121ca7
packages/react/react/src/hooks/useForceUpdate.ts
@@ -7,7 +7,18 @@ const updater = (num: number): number => (num + 1) % 1_000_000;
7
* @description
8
* 반환된 함수를 실행 시 강제로 리렌더가 실행됩니다.
9
*
10
- * @note {@link https://github.com/streamich/react-use/pull/837 useReduce가 state보다 가볍다는 의견이 있습니다.}
+ * @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보다 가볍다는 의견이 있습니다.}
22
*/
23
export function useForceUpdate(): () => void {
24
const [, forceUpdate] = useReducer(updater, 0);
0 commit comments