Storybook — configure with NextRouter
Published in
May 31, 2023
I got this error message in storybook today.
Since I redesigned the code to use the router.push
, it used useRouter
, and storybook could not pick it up properly.
Solution
.storybook/main.js
- add
storybook-addon-next-router
underaddons
(npm install first)
.storybook/preview.js
- add nextRouter config in here
Then it works!