I am using React in Action by Manning Publications. The book uses React v. 16.0.0 and I have set up my dependencies in package.json to be identical to theirs. Their code says to import as follows:
import React, { Component } from "react";
import { render } from "react-dom";
import PropTypes from "prop-types";
But when I do, I get the following error:
SyntaxError: Unexpected identifier 'React'. import call expects exactly one argument.
I've scoured Stock Overflow for an answer but could not find anything about what the error means in the context of React. I have tried using React v. 16.4.2, the current version, 16.0.1, the version that the book uses, and v. 15.0.1. Nothing changes.
The closest Stack Overflow article I could find is asking the difference between the "import react" and "{ Component }" "from 'react'" portions of the import expression.
content
is invalid; it must be a function, usually from theprop-types
package, but receivedundefined
." – Idolist