update
This commit is contained in:
20
src/ui/components/LanguageContext.ts
Normal file
20
src/ui/components/LanguageContext.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
"use client";
|
||||
|
||||
import { createContext, useContext } from "react";
|
||||
|
||||
type Language = {
|
||||
title: string;
|
||||
slug: string;
|
||||
};
|
||||
|
||||
export const LanguageContext = createContext<Language[] | null>(null);
|
||||
|
||||
export const useLanguages = () => {
|
||||
const context = useContext(LanguageContext);
|
||||
|
||||
if (!context) {
|
||||
throw new Error("useLanguages must be used inside LanguageProvider");
|
||||
}
|
||||
|
||||
return context;
|
||||
};
|
||||
Reference in New Issue
Block a user