React vs ReactDOM?

后端 未结 9 1042
野性不改
野性不改 2020-11-30 18:02

I\'m a bit new to react. I see we have to import two things to get started, React and ReactDOM, can anyone explain the difference. I\'m reading thr

9条回答
  •  时光说笑
    2020-11-30 18:44

    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).

提交回复
热议问题