Skip to content

Instantly share code, notes, and snippets.

@jbr
Created November 15, 2019 00:42
Show Gist options
  • Select an option

  • Save jbr/360c93d42e0c3df0742115fb78df732e to your computer and use it in GitHub Desktop.

Select an option

Save jbr/360c93d42e0c3df0742115fb78df732e to your computer and use it in GitHub Desktop.
TypeScript types for React DOM Concurrent Mode API (createRoot and createBlockingRoot)
declare module "react-dom" {
interface ReactRoot {
render(children: React.ReactNode, callback?: () => void): void;
unmount(callback?: () => void): void;
}
interface RootOptions {
hydrate?: boolean;
hydrationOptions?: {
onHydrated?: (suspenseNode: unknown) => void;
onDeleted?: (suspenseNode: unknown) => void;
};
}
export function createBlockingRoot(
element: HTMLElement | null,
options?: RootOptions
): ReactRoot;
export function createRoot(
element: HTMLElement | null,
options?: RootOptions
): ReactRoot;
}
¯
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment