GithubHelp home page GithubHelp logo

googlemap-react's Introduction

googlemap-react

Google Map React Component.

To install enter this into your command line:

npm install --save googlemap-react

To use as an import in you application include the below code:

import GoogleMap from 'googlemap-react';

To get access to the Google Maps API you must create your API KEY, you can do this at https://developers.google.com/maps/documentation/javascript/get-api-key, once you have received you key insert into the script tag below and add to the head of your html file:

<!-- dont forget to add this in your html -->
<script src="https://maps.googleapis.com/maps/api/js?key=YOURE_API_KEY"></script>

parameters/props that get passed into the <GoogleMap /> component attributes are inherited by the request object and used in the request to the google maps API these are mock entries below. they should give you a hint about the input types expected by the API

Example

var request = {
   origin: this.props.origin,
   destination: this.props.destination,
   travelMode: travelMode,
   transitOptions: {
    arrivalTime: this.props.arrivalTime,
    departureTime: this.props.departureTime
  }
}

Example

import React from 'react';
import ReactDOM from 'react-dom';
import GoogleMap from 'googlemap-react';

class App extends React.Component {
 constructor(props) {
   super(props);   
   console.log(GoogleMap);
 }

 render() {
   return (
     <div>        
       <GoogleMap
         arrivalTime={new Date()}
         departureTime={new Date()}
         destination={'chicago'}
         nMap={1}
         origin={'california'}
         modes={[] || null}
         travelMode={'TRANSIT'} />        
     </div>
   );
 }
}

ReactDOM.render(<App />, document.getElementById('app'));

googlemap-react's People

Contributors

albosonic avatar jguardado avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.