Vladimir37 Vladimir37 - 4 months ago 41
Javascript Question

React in WebPack

I join JS-files through WebPack. In config introduced all files.

entry: ['./file1', './file2', 'react', 'react-dom']

React and React-dom downloaded through npm. If in file I call React, returns error:

ReferenceError: React is not defined

But if I write

import {React} from 'react';

returns error

TypeError: _react.React is undefined

What am I doing wrong?


It should be like,

import React from 'react';
import ReactDOM from 'react-dom';