Answer the question
In order to leave comments, you need to log in
SearchBox google maps in React component, how?
Good afternoon! Please tell me how to display searchBox in react google maps?
Already tried everything, gives an error - Cannot read property 'SearchBox' of undefined I'm
using the google-map-react plugin.
At least tell me where to look ...
I will be very grateful!
Component code:
import React, {Component} from 'react';
export default class SearchBox extends Component {
constructor(props) {
super(props);
this.changeInp = this.changeInp.bind(this)
}
changeInp = (e, r) => {
let searchBox = google.maps.places.SearchBox(this.myTextInput);
console.log(searchBox)
console.log(google.maps)
let places = searchBox.getPlaces();
}
render() {
return (
<input id="pac-input" className="controls" onChange={this.changeInp} ref={(ref) => this.myTextInput = ref} type="text"
placeholder="Search Box"/>
)
}
}
Answer the question
In order to leave comments, you need to log in
Here - https://tomchentw.github.io/react-google-maps/#!/S...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question