'use client';


import { IntlayerClientContext } from "./IntlayerProvider.mjs";
import { getDictionary } from "../getDictionary.mjs";
import { useContext, useMemo } from "react";

//#region ../react-intlayer/dist/esm/client/useDictionary.mjs
/**
* On the server side, Hook that transform a dictionary and return the content
*
* If the locale is not provided, it will use the locale from the client context
*/
const useDictionary = (dictionary, locale) => {
	const { locale: currentLocale } = useContext(IntlayerClientContext);
	return useMemo(() => {
		return getDictionary(dictionary, locale ?? currentLocale);
	}, [
		dictionary,
		currentLocale,
		locale
	]);
};

//#endregion
export { useDictionary };
//# sourceMappingURL=useDictionary.mjs.map