diff options
Diffstat (limited to 'src/utils/misc.tsx')
-rw-r--r-- | src/utils/misc.tsx | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/utils/misc.tsx b/src/utils/misc.tsx index 005bcc0..44fc819 100644 --- a/src/utils/misc.tsx +++ b/src/utils/misc.tsx @@ -70,6 +70,11 @@ export function useAwaiter<T>(factory: () => Promise<T>, fallbackValue: T | null return [state.value, state.error, state.pending, () => setSignal(signal + 1)]; } +export function useForceUpdater() { + const [, set] = React.useState(0); + return () => set(s => s + 1); +} + /** * A lazy component. The factory method is called on first render. For example useful * for const Component = LazyComponent(() => findByDisplayName("...").default) |