본문 바로가기
Library-Framework/React

[React] Google Map Polygon 바로 띄우기

by 그랴 2023. 4. 3.

문제 상황

처음 지도가 불러와질 때 Polygon이 뜨지 않는다.

 

문제 원인

내가 사용 중인 react-google-map api의 functional component는 react strict and/or react@17+에서는 작동하지 않는다고 한다.

https://www.npmjs.com/package/@react-google-maps/api


해결 방법

1. react strict 모드 제거하기

2. react 다운그레이드 하기

 

둘 중 나는 1번 방법을 선택하였다. (다운그레이드하기 귀찮았다)


참고 문헌

https://stackoverflow.com/questions/72229607/markers-not-rendering-using-react-google-maps-api/73769832#73769832 

 

Markers not rendering using @react-google-maps/api

I'm relatively new to react world and particularly to using google maps. I'm using @react-google-maps/api and React version 18. I'm trying to display multiple locations (as markers), however, they ...

stackoverflow.com