Using API Google Places Details Error Allow Origin Cors React Project
I'm trying to use the Google Place API to get details of Places by their Id I'm using the service provided here https://developers.google.com/places/web-service/details
I'm developing on ReactJs
follows error image:
I've seen around here that for these Allow Origin cases you should use Maps JavaScript API -->https://developers.google.com/maps/documentation/javascript/places#place_details
However what is the best way to get a google.maps
reference in a REACTJS project?
Answer
I would recommend to react-google-maps
which is component based. it's community is huge.
Here is the working example of places API in react-google-maps
make sure you have an API key.
https://codesandbox.io/s/qqzm67ykmq
You need to get an API key first form here. Here are steps below for API key:
- Create a project
- Generate a API key
- Enable places API and Maps Javascript API
- Restrict your API key with these APIs
Related Questions
- → Import statement and Babel
- → should I choose reactjs+f7 or f7+vue.js?
- → Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined
- → .tsx webpack compile fails: Unexpected token <
- → React-router: Passing props to children
- → ListView.DataSource looping data for React Native
- → React Native with visual studio 2015 IDE
- → Can't test submit handler in React component
- → React + Flux - How to avoid global variable
- → Webpack, React & Babel, not rendering DOM
- → How do I determine if a new ReactJS session and/or Browser session has started?
- → Alt @decorators in React-Native
- → How to dynamically add class to parent div of focused input field?