MCPcopy
hub / github.com/pmndrs/react-spring / useForceUpdate

Function useForceUpdate

packages/shared/src/hooks/useForceUpdate.ts:5–13  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3
4/** Return a function that re-renders this component, if still mounted */
5export function useForceUpdate() {
6 const update = useState<any>()[1]
7 const isMounted = useIsMounted()
8 return () => {
9 if (isMounted.current) {
10 update(Math.random())
11 }
12 }
13}

Callers 3

useSpringsFunction · 0.90
useTransitionFunction · 0.90
withAnimatedFunction · 0.90

Calls 2

useIsMountedFunction · 0.90
updateFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…