DEV Community

Cover image for React js Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API
Osman Forhad
Osman Forhad

Posted on

React js Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API

Recently i have been working in a React js project its show me an warning in my Browser Console which is like below screen shot:

ReactDOM.render is no longer supported in React 18
don't worry i will Show you How to Solve this type of warning.
When react js warning ReactDOM.render is no longer supported in React 18
is happen then my index.js file is look like bellow screenshot:

ReactDOM.render is no longer supported in React 18
to solve the ReactDOM.render is no longer supported in React 18 Warning i just change my index.js file. after changed index.js file now my index.js is look like below Screen shot:

ReactDOM.render is no longer supported in React 18-Solution
That's it now the warning is gone. so finally Browser console is look like:

ReactDOM.render is no longer supported in React 18-Solution
Thank you
Happy Coding
.
osman forhad
Full-Stack Developer💻 (Mobile App & Web App)
developer.osmanforhad@gmail.com

Discussion (15)

Collapse
collinsruto profile image
Collins Ruto

Thanks it worked for me

Collapse
osmanforhad profile image
Osman Forhad Author

Welcome

Collapse
sammy4riner profile image
sammy4riner

Hi, how can I use react-router@6 in the new react updated version@18

Collapse
osmanforhad profile image
Osman Forhad Author
Collapse
joyshaheb profile image
Joy Shaheb

thank you for the helpful article

Collapse
osmanforhad profile image
Osman Forhad Author

Welcome

Collapse
fkbeys profile image
F.Kaya

thank you for not sharing any code

Collapse
delwarjnu11 profile image
Delwar Hossain

Thank you

Collapse
osmanforhad profile image
Osman Forhad Author

Welcome

Collapse
iddimsangi profile image
iddimsangi

Thank you,

Collapse
osmanforhad profile image
Osman Forhad Author

Welcome

Collapse
hypervenom007 profile image
Mohammed Yusuf Islam

Wow... Thank you so much sir !!

Collapse
osmanforhad profile image
Osman Forhad Author

wellcome

Collapse
duy2779 profile image
duy2779

why you don't use strict mode for react 18?

Collapse
osmanforhad profile image
Osman Forhad Author

i think it's not relevant for me