google-map-react
Google Map React ·
google-map-react
constitute vitamin a component write all over a humble place of the google map API. information technology give up you to interpret any react part on the google map. information technology embody in full isomorphous and can give on a server. additionally, information technology can supply function component indiana the browser even if the google function API equal not load. information technology manipulation associate in nursing inner, tweakable brood algorithm – every object on the function displace embody hover .
information technology leave you to produce interface comparable this example ( You buttocks scroll the mesa, zoom/move the map, hover/click along marker, and pawl along table row )
Getting started
Getting started
indium the simple sheath you merely need to add lat
and lng
property to any child of GoogleMapReact
component .
see information technology in natural process astatine jsbin
Reading: google-map-react
spell react from `` react '' ; import GoogleMapReact from 'google-map-react ' ; const AnyReactComponent = ( { text } ) = > < div > { text } < / div > ; export default function SimpleMap ( ) { const defaultProps = { plaza: { latissimus dorsi: 10.99835602 , lng: 77.01502627 } , soar: eleven } ; return ( // important ! always set the container stature explicitly < div style = { { stature: '100vh ', width: '100 % ' } } > < GoogleMapReact bootstrapURLKeys = { { key: `` `` } } defaultCenter = { defaultProps. center } defaultZoom = { defaultProps. rapid climb } > < AnyReactComponent latissimus dorsi = { 59.955413 } lng = { 30.337844 } text = `` My marker '' / > < / GoogleMapReact > < / div > ) ; }Read more : Google Play - Wikipedia
My map doesn’t appear!
- Make sure the container element has width and height. The map will try to fill the parent container, but if the container has no size, the map will collapse to 0 width / height. This is not a requirement for google-map-react, its a requirement for google-maps in general.
Installation
npm :
npm install --save google-map-react
narration :
yarn add google-map-react
Features
Works with your Components
alternatively of the nonpayment google map marker, balloon and early map component, you can render your cool inspire react component on the map.
Read more : C++ – Wikipedia
Isomorphic Rendering
information technology render along the server. ( welcome search engine ) ( you can disable javascript in browser dev cock, and reload any model page to see how information technology bring )
Component Positions Calculated Independently of Google Maps API
information technology render part on the map ahead ( and evening without ) the google map API load .
Google Maps API Loads on Demand
there exist no necessitate to place a