fullstackreact / google-maps-react

Companion code to the "How to Write a Google Maps React Component" Tutorial
https://www.fullstackreact.com/articles/how-to-write-a-google-maps-react-component/
MIT License
1.64k stars 819 forks source link

Circle invariant violation #318

Open llermaly opened 5 years ago

llermaly commented 5 years ago

Hi, I'm trying to add the Circle component to my project (example from documentation) and getting this error :

Uncaught Invariant Violation: Element 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, or you might have mixed up default and named imports.

                      <Circle
                        radius={1200}
                        center={{
                          lat: -35.675148,
                          lng: -71.542969
                        }}
                        onMouseover={() => console.log("mouseover")}
                        onClick={() => console.log("click")}
                        onMouseout={() => console.log("mouseout")}
                        strokeColor="transparent"
                        strokeOpacity={0}
                        strokeWeight={5}
                        fillColor="#FF0000"
                        fillOpacity={0.2}
                      />

Any help is appreciated

llermaly commented 5 years ago

Solved doing this :

If I remove google-maps-react and then navigate to the node_modules directory and run git clone https://github.com/fullstackreact/google-maps-react.git, it works. But I have to redo this process every time I run npm install

I hope you can publish the corrected version soon

bosunolanrewaju commented 5 years ago

@llermaly Thank you for updating the issue with your solution. I found out that you can also uninstall the package from and re-install through the git repo link

yarn remove google-maps-react
yarn add https://github.com/fullstackreact/google-maps-react.git

This adds the package to package.json file as:

. . .
"google-maps-react": "https://github.com/fullstackreact/google-maps-react.git",
. . .
LKozakewycz commented 5 years ago

For NPM, the following works.

npm install fullstackreact/google-maps-react