import { createContext, useContext, type ReactNode } from "react"; import type { ContentStore } from "@/lib/content-types"; const ContentContext = createContext(null); /** เนื้อหาที่แก้ได้ (โรงหนัง/คำศัพท์/footer) จาก loader ของ root */ export function ContentProvider({ content, children, }: { content: ContentStore; children: ReactNode; }) { return ( {children} ); } export function useContent(): ContentStore { const value = useContext(ContentContext); if (!value) throw new Error("useContent ต้องถูกใช้ภายใน "); return value; }