Skip to content

Bug: React 18 adds empty HTML comment tags in SSR markup #24263

Closed
@nbouvrette

Description

@nbouvrette

React version: 18

Steps To Reproduce

  1. Clone https://github.com/Avansai/next-multilingual
  2. run: npm install
  3. run: npm build
  4. run: npm run start-example
  5. Go to the following URL: http://localhost:3000/en-us/tests/jsx-injection
  6. Right-click on "simple link" (first sentence) and look at the HTML code - there are no HTML comment tags
  7. Kill the app, and update the react and react-dom package to version 18.0
  8. Re-run steps 2 to 5
  9. Right-click on "simple link" (first sentence) and look at the HTML code - there are empty HTML comment tags

Link to code example:

https://github.com/Avansai/next-multilingual

The current behavior

When injecting JSX element in localizable text, there are now empty HTML comment tags - this is new with React 18:

image

The expected behavior

I would expect that there are no empty HTML comment tags:

image

I tried to look in the release notes, and was wondering if this commit might be related?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: UnconfirmedA potential issue that we haven't yet confirmed as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions