frontAnswerer/lib/contexts/RootContainerWidthContext.ts

12 lines
368 B
TypeScript
Raw Normal View History

import { createContext, useContext } from "react";
export const RootContainerWidthContext = createContext<number | null>(null);
export const useRootContainerSize = () => {
const rootContainerSize = useContext(RootContainerWidthContext);
if (rootContainerSize === null) throw new Error("rootContainerSize context is null");
return rootContainerSize;
};