Comments (9)
After manually changing var google = typeof window !== 'undefined' && window.google || null;
, I get this error:
ReferenceError: document is not defined
at Object.ScriptCache.Cache._scriptTag (D:\apps\freedrive\node_modules\google-maps-react\dist\lib\ScriptCache.js:42:31)
at D:\apps\freedrive\node_modules\google-maps-react\dist\lib\ScriptCache.js:127:95
at Array.forEach (native)
at ScriptCache (D:\apps\freedrive\node_modules\google-maps-react\dist\lib\ScriptCache.js:124:34)
at defaultCreateCache (D:\apps\freedrive\node_modules\google-maps-react\dist\GoogleApiComponent.js:89:45)
at new Wrapper (D:\apps\freedrive\node_modules\google-maps-react\dist\GoogleApiComponent.js:114:41)
at D:\apps\freedrive\node_modules\react-dom\lib\ReactCompositeComponent.js:294:18
at measureLifeCyclePerf (D:\apps\freedrive\node_modules\react-dom\lib\ReactCompositeComponent.js:75:12)
at ReactCompositeComponentWrapper._constructComponentWithoutOwner (D:\apps\freedrive\node_modules\react-dom\lib\ReactCompositeComponent.js:293:16)
at ReactCompositeComponentWrapper._constructComponent (D:\apps\freedrive\node_modules\react-dom\lib\ReactCompositeComponent.js:279:21)
from google-maps-react.
Try this: #7
from google-maps-react.
@auser This issue should be able to close with the pull request I created. I followed the same suit as @7s4r in issue #7 that was merged today.
from google-maps-react.
@auser, when are you going to push another version to npm? Don't mean to nit, but I need this functionality for something I am building.
from google-maps-react.
from google-maps-react.
@smartcris I am experiencing the same issue. If you have a fix for this yet, please let me know.
from google-maps-react.
@GreatScot I ran into the same problem. There is an if before document is used, I just added && typeof document !== 'undefined'
to that.
After that there is another error because window is used. This time it happens in the render method of GoogleApiComponent.js
.
There I just replaced google: window.google
with google: typeof window !== 'undefined' ? window.google : null
from google-maps-react.
Thanks Eschon. That line seems to set the 'google' item in the <Map>
component props, so if you tell it to set 'google' to null whenever there is no window object, I guess you prevent server side rendering entirely? I think I need to figure out a better fix for these issues. Maybe I am misunderstanding?
from google-maps-react.
@GreatScot yeah the map doesn't render on the server in this case. But in my case it is only a small part of a big page and I don't really care if it is not rendered on the server as long as server side rendering works in general.
from google-maps-react.
Related Issues (20)
- How can I hide api key when inspecting on network? HOT 1
- cors error HOT 1
- prop-types should be a proper dependency
- Circle dragend event
- Unable to get marker coordinates on drag HOT 1
- Hide labels.text config on init Map
- is it possible to load geojson HOT 1
- Pin Drag Method Of Google map
- npm ERR ! HOT 1
- React cant compile anymore
- Please Update npmjs.com package to 2.0.8 its still 2.0.6 HOT 13
- Draw a route on the map HOT 1
- How to get the Current Zoom value on the Map? Is there any function to that?
- What is the difference between bounds and marginBounds?
- getting blank page maps not rendered
- Property 'children' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<InfoWindow> & Readonly<IInfoWindowProps>'
- Exposing Google Map API key HOT 2
- Style the marker
- Updated version published as @peacechen/google-maps-react
- Custom styles not beign applied to map HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from google-maps-react.