11 lines
361 B
TypeScript
11 lines
361 B
TypeScript
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;
|
|
};
|