From 2e492ce738fbfe0aab12f1bfc2c884eae2b498b2 Mon Sep 17 00:00:00 2001 From: Philzen Date: Sun, 22 Dec 2024 22:08:59 +0100 Subject: [PATCH] Fix `useEffect is not defined` in i18n template (#11788) Co-authored-by: Tobbe Lundberg --- .../setup/i18n/templates/storybook.preview.tsx.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/src/commands/setup/i18n/templates/storybook.preview.tsx.template b/packages/cli/src/commands/setup/i18n/templates/storybook.preview.tsx.template index 8c1f6f1ea6a9..6c242bb936fa 100644 --- a/packages/cli/src/commands/setup/i18n/templates/storybook.preview.tsx.template +++ b/packages/cli/src/commands/setup/i18n/templates/storybook.preview.tsx.template @@ -31,7 +31,7 @@ export const globalTypes: GlobalTypes = { */ const withI18n = (StoryFn: StoryFn, context: StoryContext) => { // eslint-disable-next-line react-hooks/rules-of-hooks - useEffect(() => { + React.useEffect(() => { i18n.changeLanguage(context.globals.locale) }, [context.globals.locale])