mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: add react v17 useTransition
polyfill (#6618)
This commit is contained in:
parent
fecbde3f5c
commit
13780f390a
2 changed files with 11 additions and 1 deletions
9
src/hooks/useTransition.ts
Normal file
9
src/hooks/useTransition.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import React, { useCallback } from "react";
|
||||
|
||||
/** noop polyfill for v17. Subset of API available */
|
||||
function useTransitionPolyfill() {
|
||||
const startTransition = useCallback((callback: () => void) => callback(), []);
|
||||
return [false, startTransition] as const;
|
||||
}
|
||||
|
||||
export const useTransition = React.useTransition || useTransitionPolyfill;
|
Loading…
Add table
Add a link
Reference in a new issue