Dangling_pointer
Dangling_pointer

Reputation: 4743

Error: Cannot resolve module 'react-dom'

I'm getting error when running webpack with babel-loader

Module not found: Error: Cannot resolve module 'react-dom'

Here is my import statement

import ReactDOM from 'react-dom' ;

I 'm using React 0.14.0

Upvotes: 1

Views: 5988

Answers (1)

Olexander Yermakov
Olexander Yermakov

Reputation: 397

In 0.14.x version dom rendering functions had been moved into react-dom package to be more universal.

As we look at packages like react-native, react-art, react-canvas, and react-three, it has become clear that the beauty and essence of React has nothing to do with browsers or the DOM.

To make this more clear and to make it easier to build more environments that React can render to, we’re splitting the main react package into two: react and react-dom. This paves the way to writing components that can be shared between the web version of React and React Native. We don’t expect all the code in an app to be shared, but we want to be able to share the components that do behave the same across platforms.

The react package contains React.createElement, .createClass, .Component, .PropTypes, .Children, and the other helpers related to elements and component classes. We think of these as the isomorphic or universal helpers that you need to build components.

The react-dom package has ReactDOM.render, .unmountComponentAtNode, and .findDOMNode. In react-dom/server we have server-side rendering support with ReactDOMServer.renderToString and .renderToStaticMarkup.

Upvotes: 2

Related Questions