Skip to content Skip to sidebar Skip to footer

Use A React Component As A Custom Overlayview In Google Maps

I am using Google Maps JavaScript API V3 to generate a map, with clustered map markers and draggable map markers. We decided against using some of the react libraries that make use

Solution 1:

I was on the same boat. I used renderToString I got the same results as you, but when I used ReactDOM.render, all my click handlers (and actual state of the component) started to work. So, in your code the change should be something like this From

const marker = ReactDOMServer.renderToString(this.icon);
container.innerHTML = marker;

To

ReactDOM.render(yourReactComponent, container)

Post a Comment for "Use A React Component As A Custom Overlayview In Google Maps"