20 lines
397 B
TypeScript
Raw Normal View History

2024-02-21 02:01:35 +07:00
import { createContext, useContext } from "react";
type TProjectContext = {
2024-02-22 12:14:58 +00:00
slug: string;
2024-02-21 02:01:35 +07:00
isCompact?: boolean;
};
const ProjectContext = createContext<TProjectContext | null>(null);
export const useProjectContext = () => {
const ctx = useContext(ProjectContext);
if (!ctx) {
throw new Error("Component not in ProjectContext!");
}
return ctx;
};
export default ProjectContext;