GMap - GMAP.js;55 Google not defined [Work around]

UI Components for React
Post Reply
chrishj
Posts: 173
Joined: 11 Jul 2011, 21:58

06 Mar 2019, 23:08

React is showing the error:
ReferenceError: google is not defined
initMap
C:\OpenClassroom\BikeRace\bikerace2020-react\node_modules\react-scripts\node_modules\babel-loader\lib\index.js??ref--6-oneOf-2!C:\OpenClassroom\BikeRace\bikerace2020-react\node_modules\primereact\components\gmap\GMap.js:155

152 | _createClass(GMap, [{
153 | key: "initMap",
154 | value: function initMap() {
> 155 | this.map = new google.maps.Map(this.container, this.props.options);
| ^ 156 |

I have google defined:

Code: Select all

import React, {Component} from 'react';
//import {Link} from 'react-router-dom';
import {GMap} from 'primereact/gmap';
import {Dialog} from 'primereact/dialog';
import {InputText} from 'primereact/inputtext';
import {Button} from 'primereact/button';
import {Checkbox} from 'primereact/checkbox';
import {Growl} from 'primereact/growl';
var google ;

export class RiderLocation extends Component {
J2EE 6 Glassfish 4.1 Mojarra 2.2.7 primefaces 6.2.7
Netbeans 8.1
database postgresql-9.4
Theme - Barcelona

chrishj
Posts: 173
Joined: 11 Jul 2011, 21:58

16 Mar 2019, 23:32

I have resolved the issue by using the Google API directly in the React app
J2EE 6 Glassfish 4.1 Mojarra 2.2.7 primefaces 6.2.7
Netbeans 8.1
database postgresql-9.4
Theme - Barcelona

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests