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

UI Components for React
Post Reply
chrishj
Posts: 229
Joined: 11 Jul 2011, 21:58
Location: England, Lancashire
Contact:

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 {
PrimeReact: 9.6.0
NextJs: 13.4.12
Theme Apollo v9.0
Database pg 8.8.0
react-hook-form: 7.38.0

chrishj
Posts: 229
Joined: 11 Jul 2011, 21:58
Location: England, Lancashire
Contact:

16 Mar 2019, 23:32

I have resolved the issue by using the Google API directly in the React app
PrimeReact: 9.6.0
NextJs: 13.4.12
Theme Apollo v9.0
Database pg 8.8.0
react-hook-form: 7.38.0

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 16 guests