'Reading properties of undefined error with WithNextRouter and Storybook
I got "Cannot read properties of undefined (reading 'name')" using WithNextRouter in story.
export default {
component: Navbar,
title: "Components/Navbar",
decorators: [
withNextRouter,
(story) => (
<div
className="bg-white w-full relative overflow-hidden"
style={{ height: "4000px" }}
>
{story()}
</div>
),
],
};
Do I even need it to be in export? If I remove withNextRouter then everything works. However, component uses Link from "next/link" and to mock router I believe storybook needs this decorator.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
