When building web applications in React, you use two packages—
Why is there
react-dom? What is the difference?
react package holds the react source for components, state, props and all the code that is react.
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
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.