Created
April 16, 2021 07:03
-
-
Save hrdtbs/aa1d7cc81633d01fdffa80e0c492607d to your computer and use it in GitHub Desktop.
How to mock Next.js image component & Next.js link component in Storybook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as NextImage from "next/image" | |
const OriginalNextImage = NextImage.default | |
Object.defineProperty(NextImage, "default", { | |
configurable: true, | |
value: props => <OriginalNextImage {...props} unoptimized /> | |
}) | |
import * as NextLink from "next/link" | |
const OriginalNextLink = NextLink.default | |
Object.defineProperty(NextLink, "default", { | |
configurable: true, | |
value: props => <OriginalNextLink {...props} prefetch={false} /> | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment