“Google Map en React JS” Código de respuesta

Google Map en React JS

import React, { Component } from 'react';
import GoogleMapReact from 'google-map-react';

const AnyReactComponent = ({ text }) => <div>{text}</div>;

class SimpleMap extends Component {
  static defaultProps = {
    center: {
      lat: 59.95,
      lng: 30.33
    },
    zoom: 11
  };

  render() {
    return (
      // Important! Always set the container height explicitly
      <div style={{ height: '100vh', width: '100%' }}>
        <GoogleMapReact
          bootstrapURLKeys={{ key: /* YOUR KEY HERE */ }}
          defaultCenter={this.props.center}
          defaultZoom={this.props.zoom}
        >
          <AnyReactComponent
            lat={59.955413}
            lng={30.337844}
            text="My Marker"
          />
        </GoogleMapReact>
      </div>
    );
  }
}

export default SimpleMap;
Scary Salmon

@react-google-maps/API NPM

npm i -S @react-google-maps/api
Evil Eagle

Reaccionar el mapa de Google

npm install --save google-map-react
Nutty Newt

Google Map React Place

npm install google-map-react
Scorpius

Cómo agregar el mapa de Google en React JS

import React, { Component } from 'react';import GoogleMapReact from 'google-map-react'; const AnyReactComponent = ({ text }) => <div>{text}</div>; class SimpleMap extends Component {  static defaultProps = {    center: {      lat: 59.95,      lng: 30.33    },    zoom: 11  };   render() {    return (      // Important! Always set the container height explicitly      <div style={{ height: '100vh', width: '100%' }}>        <GoogleMapReact          bootstrapURLKeys={{ key: /* YOUR KEY HERE */ }}          defaultCenter={this.props.center}          defaultZoom={this.props.zoom}        >          <AnyReactComponent            lat={59.955413}            lng={30.337844}            text="My Marker"          />        </GoogleMapReact>      </div>    );  }} export default SimpleMap;
Uptight Unicorn

Respuestas similares a “Google Map en React JS”

Preguntas similares a “Google Map en React JS”

Más respuestas relacionadas con “Google Map en React JS” en JavaScript

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código