Doesn't work with React.Fragment
See original GitHub issueHello
I’ve tried to use addon-jsx
for story that uses React.Fragment like this:
.addWithJSX('bubble with components inside of it', () => (
<Fragment>
<MyComponent props />
<MyComponent otherProps/>
</Fragment>
));
and it fails with error:
Cannot convert a Symbol value to a string
at exports.default (http://localhost:9001/static/preview.bundle.js:85619:17)
at exports.default (http://localhost:9001/static/preview.bundle.js:81301:49)
at exports.default (http://localhost:9001/static/preview.bundle.js:85518:39)
at reactElementToJsxString (http://localhost:9001/static/preview.bundle.js:85494:35)
at http://localhost:9001/static/preview.bundle.js:85400:50
at mapSingleChildIntoContext (http://localhost:9001/static/preview.bundle.js:15121:26)
at traverseAllChildrenImpl (http://localhost:9001/static/preview.bundle.js:14994:5)
at traverseAllChildren (http://localhost:9001/static/preview.bundle.js:15065:10)
at mapIntoWithKeyPrefixInternal (http://localhost:9001/static/preview.bundle.js:15141:3)
at Object.mapChildren [as map] (http://localhost:9001/static/preview.bundle.js:15163:3)
It works perfectly once I replace <Fragment>
with plain <div>
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:5 (2 by maintainers)
Top Results From Across the Web
React Fragment not rendering in function [duplicate]
My api query works fine and I can get the data I'm after but I'm struggling displaying it in the component. import React...
Read more >Fragments - React
A common pattern in React is for a component to return multiple elements. Fragments let you group a list of children without adding...
Read more >Can't use React.Fragment · Issue #12097 - GitHub
Use <React.Fragment></React.Fragment> or <></> syntax to render mapped fragments. ... Try to render the component. Get met with this error:.
Read more >Understanding React fragments - LogRocket Blog
Fragments are syntax that allow us to add multiple elements to a React component without wrapping them in an extra DOM node. ......
Read more >React Fragments: Eliminate Unnecessary Divs - G2i
React Fragments are used here to group together the other nodes, making it a single element being returned by MyComponent and it doesn't...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I am facing the same issue with https://github.com/storybooks/storybook/tree/master/addons/info This temporary solution/hack works for me:
I also see this issue with the combination of React.Fragment and the withInfo addon in Storybook 5.0.6