-3

I am new to react and someone who usually use create-react-app for my projects.

As I was exploring, I saw npm react-dom package.

which also happens to be inside our create-react-app

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';

ReactDOM.render(<App />, document.getElementById('root'));
registerServiceWorker();

But for some reason, the documentation for the same looks vague and hard for me to comprehend.

so, can someone please explain what does react-dom does?

  • Use search BEFORE asking? https://stackoverflow.com/questions/34114350/react-vs-reactdom – xadm Aug 19 '18 at 09:37

1 Answers1

1

React as a library is not limited to web only. It can be used to create "native" iOS/Android apps. It can even be used to create VirtualReality experiences!

So react package contains the library core, while packages like react-dom are used to integrate React into specific platforms:

  • react-dom: Web integration. DOM stands for Document Object Model
  • react-native: Integration into native iOS and Android apps
  • react-360: Integration into VR platform

And there are many more!

Igor Pantović
  • 9,107
  • 2
  • 30
  • 43