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

Addon imports on documentation should be named imports #610

Closed
valstu opened this issue Sep 14, 2017 · 1 comment
Closed

Addon imports on documentation should be named imports #610

valstu opened this issue Sep 14, 2017 · 1 comment

Comments

@valstu
Copy link

valstu commented Sep 14, 2017

Description

We just updated to version 8.0.0 and followed the docs to create clusters on a map with <MarkerClusterer />. You will get the following error on console:

Warning: React.createElement: type is invalid -- expected a string (for built-in components) 
or a class/function (for composite components) but got: undefined. 
You likely forgot to export your component from the file it's defined in.

Solution

In documentation example you're importing as "default import". It should be named import. MarkerClusterer is named export as you can see from line 17. https://github.com/tomchentw/react-google-maps/blob/master/src/components/addons/MarkerClusterer.jsx#L17

InfoBox documentation has the same thing. It should be named import.

How to reproduce

Here's a link to CodeSandbox

Edit 21q35lr49n

Open the link, open console and run. You will get the error mentioned above. Change line 8 on Map.js to named import import { InfoBox } from "react-google-maps/lib/components/addons/InfoBox";
and everything works as intended.

tomchentw added a commit that referenced this issue Sep 14, 2017
tomchentw added a commit that referenced this issue Sep 14, 2017
tomchentw added a commit that referenced this issue Sep 14, 2017
tomchentw added a commit that referenced this issue Sep 14, 2017
tomchentw added a commit that referenced this issue Sep 15, 2017
tomchentw added a commit that referenced this issue Sep 15, 2017
tomchentw added a commit that referenced this issue Sep 15, 2017
tomchentw added a commit that referenced this issue Sep 15, 2017
@tomchentw
Copy link
Owner

Released v8.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants