laravel-inertia-react-translator
Version:
A integration for i18n in inertia with laravel for react
12 lines (9 loc) • 325 B
text/typescript
import { useContext } from "react";
import TranslationContext from "../context/TranslationContext";
export const useTranslation = () => {
const context = useContext(TranslationContext);
if (!context) {
throw new Error("useTranslation must be used within a TranslationProvider");
}
return context;
};