-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
It's not possible to export decorator that contains React or HTML tags Storybook 6.0 #11723
Comments
Is this a regression, i.e. are you upgrading the project from 5.x and it was working there? |
@shilman No, I kicked off with 6.0 rc but looking at some other threads and examples I'd expect this to work but maybe I misunderstood some documentation. I can try to reproduce this case with edit: Also, for people coming here in the future looking for some workarounds I went for splitting components into "connected" and "not connected" for Redux and react-router-dom so that:
Then in Storybook we can import the named one, not connected to Redux, and provide the propFromRedux by hand. Similar for react-router and |
@shilman Alright, I think I managed to fix my issue. It was incorrect babel config in the root of my project. I also needed to add
then this works just fine:
Thanks for help anyway, keep up the good work you're doing here! 😄 We can close this issue. |
Describe the bug
When trying to export a decorator that contains React or HTML tags, Storybook returns an error.
To Reproduce
Steps to reproduce the behavior:
preview.js
with for example:You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file.
Expected behavior
Storybook exports decorator
Additional context
I tried adding such rule to webpack:
but then the error is:

Support for the experimental syntax 'jsx' isn't currently enabled
My main goal here was to globally wrap my components with
<MemoryRouter />
fromreact-router-dom
and Redux<Provider />
instead of doing that every time. If there's any other way of doing that I'm open for suggestions.Code snippets
System:
System:
OS: macOS 10.15.4
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Binaries:
Node: 12.16.3 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.5 - /usr/local/bin/npm
Browsers:
Chrome: 84.0.4147.89
Firefox: 78.0.2
Safari: 13.1
npmPackages:
@storybook/addon-docs: 6.0.x-rc.16 => 6.0.0-rc.16
@storybook/addon-viewport: 6.0.x-rc.16 => 6.0.0-rc.16
@storybook/addons: 6.0.x-rc.16 => 6.0.0-rc.16
@storybook/react: 6.0.x-rc.16 => 6.0.0-rc.16
The text was updated successfully, but these errors were encountered: