title: How can i get the location of the user - Using at React Map GL
body: <p>I'm using React Map GL, and I want to put the latitude and longitude of the user</p>
  
  <p>Returning the component like this: </p>
  
  <pre><code>export default geolocated({
    positionOptions: {
      enableHighAccuracy: false
    },
    userDecisionTimeout: 5000
  })(Layout);
  </code></pre>
  
  <p>I'm tried to use react-geolocated but it's returning null coords. </p>
  
  <p>I want to get these informations when the component mounts, that's the code:</p>
  
  <pre><code> componentDidMount() {
  
      console.log(this.props);
      if (navigator.geolocation) {
  
       const viewport = {
           ...this.state.viewport,
           latitude: this.props.coords.latitude,
          longitude: this.props.coords.longitude
       };
  
         this.setState({ viewport });
    }
  
  }
  </code></pre>
  
  <p>The map component: </p>
  
  <pre><code>&lt;MapGL
              {...viewport}
              //onClick={this.handleMapClick}
              mapStyle="mapbox://styles/mapbox/streets-v9"
              mapboxApiAccessToken={TOKEN}
              perspectiveEnabled
              onViewportChange={viewport =&gt; this.setState({ viewport })}
            &gt;
              &lt;div className="geo" style={geolocateStyle}&gt;
                {" "}
                &lt;GeolocateControl
                  positionOptions={{ enableHighAccuracy: true }}
                  trackUserLocation={true}
                /&gt;
              &lt;/div&gt;
  
              &lt;div className="nav" style={navStyle}&gt;
                &lt;NavigationControl
                  onViewportChange={viewport =&gt; this.setState({ viewport })}
                /&gt;
              &lt;/div&gt;
            &lt;/MapGL&gt;
  </code></pre>
  
  <p>I'm getting the props like this: </p>
  
  <pre><code>{coords: null, isGeolocationAvailable: true, isGeolocationEnabled: true, positionError: null}
  </code></pre>