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

Replaced deprecated render with createRoot #138

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

adrien-dimitri
Copy link

Hello, @alfredodeza , there was an issue with render after they deprecated it with React 18. I have had issues with it myself and it was causing my deployed page to be blank. Issue#132 mentioned this exact same problem and i provided an easy fix.

Actually, only index.js needed to be updated and after some saerching, I found the fix and wanted to create a pull request.

Original:

/**
 * Entry point of application, where App is rendered within the div with the id of "app" 
 */

import React from "react";
import { render } from "react-dom";

import App from "./App";

render(<App></App>, document.getElementById("app"));

Fixed:

/**
 * Entry point of application, where App is rendered within the div with the id of "app" 
 */

import React from "react";
import { createRoot } from "react-dom/client";

import App from "./App";

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

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

Successfully merging this pull request may close these issues.

1 participant