You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use useParams in a Storybook story (directly or indirectly), it returns null, even when @storybook/nextjs is installed and .storybook/preview.js#parameters.nextjs.addDirectory is set to true.
This implies that the navigation context has not been correctly configured to include a params object (which should be an empty record {} by default, but presumably should also be configurable).
// preview.tsximporttype{Preview}from"@storybook/react";constpreview: Preview={parameters: {nextjs: {appDirectory: true,navigation: {pathname: "/en/about",query: {language: "en",},// Am I missing something here? Perhaps there is a `params` property?},},},};exportdefaultpreview;
Then, write a story which uses next/navigation#useParams:
Describe the bug
When I use
useParams
in a Storybook story (directly or indirectly), it returnsnull
, even when@storybook/nextjs
is installed and.storybook/preview.js#parameters.nextjs.addDirectory
is set totrue
.This implies that the
navigation
context has not been correctly configured to include a params object (which should be an empty record{}
by default, but presumably should also be configurable).To Reproduce
Install
@storybook/nextjs
:Then, write a story which uses
next/navigation#useParams
:You get an error like:
System
The text was updated successfully, but these errors were encountered: