Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

ReactDOM.render is no longer supported in React 18

// Before
import { render } from 'react-dom';
const container = document.getElementById('app');
render(<App tab="home" />, container);

// After
import { createRoot } from 'react-dom/client';
const container = document.getElementById('app');
const root = createRoot(container);
root.render(<App tab="home" />);
Comment

Deprecation notice: ReactDOM.render is no longer supported in React 18

Deprecation notice: ReactDOM.render is no longer supported in React 18


For typescript go with the below:

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

ReactDOM.render is no longer supported in React 18

import * as ReactDOMClient from 'react-dom/client';
import App from 'App';

const container = document.getElementById('app');

// Create a root.
const root = ReactDOMClient.createRoot(container);

// Initial render: Render an element to the root.
root.render(<App tab="home" />);

// During an update, there's no need to pass the container again.
root.render(<App tab="profile" />);
Comment

ReactDOM.render is no longer supported in React 18

import * as ReactDOM from 'react-dom';
import App from 'App';

const container = document.getElementById('app');

// Initial render.
ReactDOM.render(<App tab="home" />, container);

// During an update, React would access
// the root of the DOM element.
ReactDOM.render(<App tab="profile" />, container);
Comment

PREVIOUS NEXT
Code Example
Javascript :: js contains class 
Javascript :: truthy or falsy value javascript 
Javascript :: moment timezone get offset from iana timezone 
Javascript :: angular 10 set error on form controle 
Javascript :: js convert string to script 
Javascript :: rotate a div using javascript 
Javascript :: vue js get width of element 
Javascript :: how map on object in javascrtipt 
Javascript :: json enconde 
Javascript :: protractor screen size 
Javascript :: how long old upvc 
Javascript :: get next month js 
Javascript :: javascript number to number with commas 
Javascript :: get epoch timestamp js 
Javascript :: how to hide javascript element by class 
Javascript :: JavaScript changing the color of an html element 
Javascript :: js set cookie 
Javascript :: sum an array in javascript 
Javascript :: Return the Next Number from the Integer Passed javascript 
Javascript :: js regex password 
Javascript :: check whether a checkbox is checked in jQuery 
Javascript :: react useref file input 
Javascript :: mongoose virtual populate not working 
Javascript :: p5.js style 
Javascript :: regex pater for only 4 or 6 digits 
Javascript :: javascript test if element has focus 
Javascript :: // Write a function that takes two strings (a and b) as arguments // If a contains b, append b to the beginning of a // If not, append it to the end // Return the concatenation 
Javascript :: React modal input field auto focus antd 
Javascript :: react absolute import 
Javascript :: parsefloat.tofixed in javascript 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =