Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES6 Destructuring with <Link> #2468

Closed
guyellis opened this issue Nov 4, 2015 · 2 comments
Closed

ES6 Destructuring with <Link> #2468

guyellis opened this issue Nov 4, 2015 · 2 comments

Comments

@guyellis
Copy link

guyellis commented Nov 4, 2015

I was getting errors that look like this:

Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components). Check the render method of Navbar.

The Navbar.jsx file has a typical layout for a menu. The only Router element in there is <Link>.

Getting the Link dependency using:

import Router from 'react-router';
var {Link} = Router;

is causing this problem.

If I switch to using:

import {Link} from 'react-router';

Then the error goes away and everything works.

To me this looks like a ES6/Babel issue and not a React Router issue. I wanted to check here first to confirm that or can anyone see what I'm doing wrong with my destructuring?

@taion
Copy link
Contributor

taion commented Nov 4, 2015

It's not an "issue", it's that in one case you're doing a default import while in the other case you're doing a named import, and the semantics are not the same when using ES6 modules.

For questions and support, please visit our channel on Reactiflux or Stack Overflow. The issue tracker is exclusively for bug reports and feature requests.

@taion taion closed this as completed Nov 4, 2015
@guyellis
Copy link
Author

guyellis commented Nov 4, 2015

Stack Overflow Q&A if anyone finds this "issue": http://stackoverflow.com/questions/33524696/es6-destructuring-and-module-imports

@lock lock bot locked as resolved and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants