React vs ReactDOM

React vs ReactDOM

When building web applications in React, you use two packages—react and react-dom.

Why is there react and react-dom? What is the difference?

The react package holds the react source for components, state, props and all the code that is react.

The react-dom package as the name implies is the glue between React and the DOM. Often, you will only use it for one single thing: mounting your application to the index.html file with ReactDOM.render().

Why separate them?

The reason React and ReactDOM were split into two libraries was due to the arrival of React Native (A react platform for mobile development).

React components are such a great way to organize UI that it has now spread to mobile to react is used in web and in mobile. react-dom is used only in web apps.