React TutorialLesson 5Free preview
React Render HTML
This lesson is part of React · All levels
Summary
To display JSX on the screen, React provides the createRoot API from the react-dom/client package. You create a root from an existing DOM element, then call a render method with the component you want to display. This method replaces the old ReactDOM.render method that was deprecated in React 18.
Key points
- Import createRoot from react-dom/client
- CreateRoot receives DOM elements, not string selectors
- The method render is called once at the application entry point
- It was replaced by createRoot since React 18
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.