Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
mayank99 opened this issue Feb 16, 2024 · 1 comment
Closed

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

mayank99 opened this issue Feb 16, 2024 · 1 comment

Comments

@mayank99
Copy link
Contributor

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>
felipe-b-oliveira added a commit to felipe-b-oliveira/react.dev that referenced this issue Feb 17, 2024
eps1lon pushed a commit that referenced this issue Feb 18, 2024
@rickhanlonii
Copy link
Member

Fixed in #6641

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants