Bug.
Styled JSX inside a React Fragment container causes a rendering error.
Mounting this component:
const Test = () => (
<>
<p>Test</p>
<style jsx>{`
p {
color: red;
}
`}</style>
</>
)
Causes this error:
Warning: Received `true` for a non-boolean attribute `jsx`.
No rendering error.
There were other bugs with fragments which have since been closed.
styled-jsx is not compatible with Babel7 yet but it would probably as simple as also visiting JSXFragment like we do for JSXElement
Any update on this?
And is the incompatibility with Babel 7 documented anywhere? Just lost hours trying to debug this before figuring out it was the new Fragment syntax that was causing it.
Can this please be escalated to bug status? It makes no sense that this will work:
import { Fragment } from 'react'
const Logo = () => (
<Fragment>
<img src="/static/logo.svg" />
<style jsx>{`
img {
border-radius: 50%;
}
`}</style>
</Fragment>
)
... and this legitimate syntax (supported by stable React and Babel) won't:
const Logo = () => (
<>
<img src="/static/logo.svg" />
<style jsx>{`
img {
border-radius: 50%;
}
`}</style>
</>
)
We need to make a patch release before starting to work on v4 and switch to babel 7. I don鈥檛 do this for a living so sometimes things can be slower. If any bugfix or feature is crucial for your work I welcome any contribution and I鈥檇 be happy to give guidance and help
A heads up (see referenced issue above) that this bug resurfaced when using the styled-jsx-plugin-sass plugin.
Most helpful comment
Can this please be escalated to bug status? It makes no sense that this will work:
... and this legitimate syntax (supported by stable React and Babel) won't: