React and React DOM
- The root node is the HTML element where you want to display the result. It is like a container for content managed by React.
ReactDOM.createRoot
: Create a root to display React components inside a browser DOM node.
render
: Display a React component inside a browser DOM element.
React.createElement
: lets you create a React element.
New Syntax
const rootNode = document.getElementById('root');
const root = ReactDOM.createRoot(rootNode);
root.render(React.createElement(LikeButton));
Old syntax
ReactDOM.render(<p>Hello</p>, document.getElementById('root'));