import ReactRouter imports only the default export. It does not import the object with the specified export, which is what you are trying to achieve in ES6 code. If there is no default export in the module, this ReactRouter will be undefined .
As stated, import { Link } from 'react-router' is a dedicated syntax for importing a single named export.
If you want to import all named exports into an object, you can use the import..as syntax:
import * as ReactRouter from 'react-router'; var Link = ReactRouter.Link
MDN has a super-useful list of all types of imports and how they work.
CodingIntrigue
source share