“Miejsce wyszukiwania mapy Google React” Kod odpowiedzi

Mapa Google w 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

Miejsce wyszukiwania mapy Google React

npm install google-map-react
Scorpius

Odpowiedzi podobne do “Miejsce wyszukiwania mapy Google React”

Pytania podobne do “Miejsce wyszukiwania mapy Google React”

Więcej pokrewnych odpowiedzi na “Miejsce wyszukiwania mapy Google React” w JavaScript

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu