Git Product home page Git Product logo

Comments (9)

smartcris avatar smartcris commented on May 18, 2024 1

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.

7s4r avatar 7s4r commented on May 18, 2024

Try this: #7

from google-maps-react.

kcode20 avatar kcode20 commented on May 18, 2024

@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.

kcode20 avatar kcode20 commented on May 18, 2024

@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.

auser avatar auser commented on May 18, 2024

from google-maps-react.

thomasmarr avatar thomasmarr commented on May 18, 2024

@smartcris I am experiencing the same issue. If you have a fix for this yet, please let me know.

from google-maps-react.

Eschon avatar Eschon commented on May 18, 2024

@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.

thomasmarr avatar thomasmarr commented on May 18, 2024

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.

Eschon avatar Eschon commented on May 18, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.