2024-02-05 10:10:02 +00:00
|
|
|
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-02-05 10:10:02 +00:00
|
|
|
|
2024-05-31 16:41:18 +00:00
|
|
|
return rootContainerSize;
|
2024-02-05 10:10:02 +00:00
|
|
|
};
|