React & Modern Frontend (445 Qs)•Part 1: Core React, JSX & Component Architecture (1 - 77)
What is the difference between React and ReactDOM?
The react package contains React.createElement(), React.Component, React.Children, and other helpers related to elements and component classes. You can think of these as the isomorphic or universal helpers that you need to build components. The react-dom package contains ReactDOM.render(), and in react-dom/server we have server-side rendering support with ReactDOMServer.renderToString() and ReactDOMServer.renderToStaticMarkup().
Practical Code Example
javascript
// 'react': Defines components, hooks (useState, useEffect), and JSX elements (isomorphic)
// 'react-dom': Renders elements to browser DOM (createRoot, hydrateRoot)
// 'react-native': Renders elements to iOS / Android native widgets