Created
June 1, 2022 15:44
-
-
Save GitaiQAQ/7095148d90f0c3dca8c83b79c5d4dc37 to your computer and use it in GitHub Desktop.
useForceUpdate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const useForceUpdate = () => Object.assign.apply(null, useReducer(({ current }) => ({ current: current + 1 }), { current: 0 }).reverse()); | |
functioin Test() { | |
const forceUpdate = useForceUpdate(); | |
const dataMap = useMemo(() => new WeakMap(), [forceUpdate.current]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment