diff options
Diffstat (limited to 'modern/src/LocalizationProvider.js')
-rw-r--r-- | modern/src/LocalizationProvider.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/modern/src/LocalizationProvider.js b/modern/src/LocalizationProvider.js index cc23d724..d2c663a3 100644 --- a/modern/src/LocalizationProvider.js +++ b/modern/src/LocalizationProvider.js @@ -1,4 +1,4 @@ -import React, { createContext, useContext } from 'react'; +import React, { createContext, useContext, useMemo } from 'react'; import usePersistedState from './common/usePersistedState'; import af from '../../web/l10n/af.json'; @@ -155,7 +155,7 @@ export const useLocalization = () => useContext(LocalizationContext); export const useTranslation = () => { const context = useContext(LocalizationContext); const { data } = context.languages[context.language]; - return (key) => data[key]; + return useMemo(() => (key) => data[key], [data]); }; export const useTranslationKeys = (predicate) => { |