Skip to content

Updates to Client Rendering APIs [ React 18 ] #12838

@alamenai

Description

@alamenai

Is your proposal related to a problem?

It's related to Warning showing on the Browser:

ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it’s running React 17. Learn more: https://reactjs.org/link/switch-to-createroot

Hardware && Software:

  • Hardware: LG gram

  • Operating System: LInux Ubuntu 22.04

  • Browser: Chrome

  • Editor: VS Code

Steps:

1 - Run create-react-app command:

npx create-react-app react-tuto

2 - Run npm run start command:

npm run start

Result:

The browser shows this error:

ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it’s running React 17. Learn more: https://reactjs.org/link/switch-to-createroot

What I do

I change the code of index.js to :

import React from "react";
import { createRoot } from "react-dom/client";
import App from "./App";
import "./index.css";

const container = document.getElementById("root");
const root = createRoot(container);

root.render( <App/>)

Proposal

It`s better to give developers a way to start or switch between React 18 features or just React 17.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions