12 lines
368 B
TypeScript
12 lines
368 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;
|
||
|
};
|