Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

google map in 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;
Comment

how to add google map in 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;
Comment

PREVIOUS NEXT
Code Example
Javascript :: js date 
Javascript :: regex and 
Javascript :: event listener 
Javascript :: kafkajs 
Javascript :: string charat 
Javascript :: push pop in javascript 
Javascript :: javascript numbers 
Javascript :: javascript load content from file 
Javascript :: Javascript count instances of character in a string 
Javascript :: JavaScript HTML DOM Event 
Javascript :: for loop in js 
Javascript :: how to loop over dom objects javascript 
Javascript :: javascript operators 
Javascript :: donwload data from react js in json file 
Javascript :: adding pre tag javascript 
Javascript :: open modal using jquery 
Javascript :: why we use $ in jquery 
Javascript :: scroll position 
Javascript :: alertify js examples 
Javascript :: sum of a sequence 
Javascript :: how to build a string javascript es6 
Javascript :: React_Weather_APp 
Javascript :: close browser tab using jquery 
Javascript :: flatmap js 
Javascript :: quadratic equation in js by function 
Javascript :: automated email sending using node js server 
Javascript :: form action using react 
Javascript :: javascript console log current directory 
Javascript :: call function add parameter javascript 
Javascript :: does javascript buelt applications 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =