Skip to content

Commit

Permalink
feat(suggestion): move cache const out of hook
Browse files Browse the repository at this point in the history
  • Loading branch information
menusal committed Jul 4, 2023
1 parent 379e761 commit 176030e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/react-ui/src/hooks/useLocale.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { messages } from '../localization';
import { useMemo } from 'react';

const DEFAULT_LANGUAGE = 'en';
const cache = createIntlCache();
/**
* React hook to handle custom locale messages to override default ones
* @param {object} localizationMessages
*/
export default function useLocale(localizationMessages) {
const cache = createIntlCache();
const intl = useMemo(
() =>
createIntl(
Expand All @@ -18,7 +18,7 @@ export default function useLocale(localizationMessages) {
},
cache
),
[localizationMessages, cache]
[localizationMessages]
);

return intl;
Expand Down

0 comments on commit 176030e

Please sign in to comment.