reboot alterflixhub

This commit is contained in:
Bkk1234 committed 2026-11-01 17:24:44 +07:00
commit 1e84023a44
188 files changed
+31629

No files matched your search

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