Skip to content

[Typo]: <style> syntax looks wrong #6633

Description

@mayank99

Summary

The new <style> page shows this snippet at the very top:

<style>p { color: red; } </style>

While it is totally valid in regular HTML, it does not work in JSX (would be nice if it did though).

Error/src/App.js: Unexpected token, expected "}" (3:21) 1 | export default function App() { 2 | return (
> 3 |<style> p { color: red; } </style> | ^ 4 | ); 5 | } 6 |

Page

https://react.dev/reference/react-dom/components/style

Details

I believe JSX requires this workaround:

<style>{` p { color: red; } `}</style>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions