reactjs / reactjs/react.dev

<Fragment> tag does not render html in chrome nor throw any error in JSX Preprocessing

Open
#5,551 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
11.8k
Forks
7.9k
Avg merge
1d 11h
Merged PRs (30d)
11

Description

https://beta.reactjs.org/reference/react/Fragment#fragment

Doesnt throw error in jsx preprocessing(npx babel --watch sr --out-dir . --presets react-app/prod) for babel version:6.26 installed as per current official react install docs ,please have a check if new beta version supports.
Can be related to
#5532 ?
{/* index.html */}
index.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>Test Page-React</title>
  </head>
  <body>

<div id="Sc"></div>
<script src="https://unpkg.com/react@18/umd/react.development.js" crossorigin></script>
    <script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js" crossorigin></script>
  <!-- Load your React component. -->
 <script type="module" src="test.js"></script>
 </body>
</html>

{/* test.js */}
{
const root9 = ReactDOM.createRoot(document.getElementById('Sc'));
const element9 = <Gallery />; 
root9.render(element9);

function ProfileS() {
  return (
    <img
      src="https://i.imgur.com/MK3eW3As.jpg"
      alt="Katherine Johnson"
    />
  );
}

function Gallery() {
  return (
  <Fragment>
    <div> 
      <h1>Amazing scientists</h1>
      <ProfileS /> {/* react component 1 */}
      <ProfileS /> {/* react component 2 */}
      <ProfileS /> {/* react component 3 */}
    </div>
	  <div> 
      <ProfileS /> {/* react component 1 */}
      <ProfileS /> {/* react component 2 */}
    </div>
	<div>	  
	<Pile />
    </div>
  </Fragment>
  );
}

function Pile() {
  return (
    <img
      src="https://i.imgur.com/QIrZWGIs.jpg"
      alt="Alan L. Hart"
    />
  );
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Fragment reference linked in the issue, then reproduce the example from test.js using the provided index.html and the npx babel --watch command with Babel 6.26. Confirm whether the documented Fragment example renders with the React 18 UMD scripts, and update the relevant documentation or report the confirmed incompatibility.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.