frontAnswerer/lib/contexts/RootContainerWidthContext.ts

11 lines
361 B
TypeScript
Raw Normal View History

import { createContext, useContext } from "react";
export const RootContainerWidthContext = createContext<number | null>(null);
export const useRootContainerSize = () => {
2024-05-31 16:41:18 +00:00
const rootContainerSize = useContext(RootContainerWidthContext);
if (rootContainerSize === null) throw new Error("rootContainerSize context is null");
2024-05-31 16:41:18 +00:00
return rootContainerSize;
};