In this post, we will be setting up Next.js and Storybook in a way that makes it possible to use Next.js' Image component in components rendered in...
For further actions, you may consider blocking this person and/or reporting abuse
Very, very helpful! I'm also using Sanity.io as a CMS and had to use a fallback prop since I'm not passing in JSON data for each image. If anyone else wants to know what I did, I just used the OR operator like so:
Hey! Thank you so much! You've saved me a lot of time
Glad it helped!
Works like a charm, thanks.
This was a life-saver, thanks!
Thank you very much for sharing.It was really helpful.
Very helpful post. I struggled to find solution for 3 hours but no other blog could help me. I solved after reading this post.
Many thanks Jonas!!! :)
It's not working for me
Something might have changed since I wrote the post. Can you tell me more specifics? What is not working exactly? Do you get any error messages? Then I will try to update the post.
Didn't work for me either. What worked for me is providing defaultProps with unoptimized = true in "preview.js"
Thank you both, guys! Oleg's tweak was needed as well in to make it work properly ("next": "12.1.6" + "@storybook/react": "^6.5.9")
Hey! Sorry, I'm currently working with neither next nor storybook anymore and frankly, don't have the time right now to go into this and comprehend what is going on. Still, this post seems to be pretty popular and I'd like it to be at least correct and runnable when people find it. Would you be willing to suggest the necessary changes to my post to make it map to what you had to do? I would then change the necessary parts and mark you as contributors. Would be really cool!
Thank you for sharing, Jonas. I ran into this problem and your article helped me a lot!
Hey Rafael, really glad to hear that! If you run into any other problems related to this, please tell me about them and your solution and I will add them to the post (with attribution to you of course).
The
-s public/
seems to be deprecated.Use
staticDirs: ['../public']
in main.js instead.Very helpful! Thank you!
Thank you, working...
Great article! Storybook has a add-on now which does this automatically with a few other things.
Link: storybook.js.org/addons/storybook-...
Thank you so much!!!
Muchisimas gracias. Enserio me sacó de un apuro!