parcel-bundler / website

🌎 Parcel website
https://parceljs.org
MIT License
350 stars 468 forks source link

Update the React recipe for React v18 #1049

Open rapaccinim opened 2 years ago

rapaccinim commented 2 years ago

The React recipe is not showing a correct example of src/index.js for React v18.

ReactDOM.render is no more used in React v18, instead it's necessary to use ReactDOM.createRoot.

This is a practical working example that can be used:

import ReactDOM from "react-dom/client";
import { App } from "./App";

const root = ReactDOM.createRoot(document.getElementById("app"));
root.render(<App />);