const searchCoordinateToAddress = (lat, lng) => { navermaps.Service.reverseGeocode( { location: new navermaps.LatLng(lat, lng), }, function (status, response) { if (status !== navermaps.Service.Status.OK) { return alert('Something wrong!'); } setAddress(response.result.items[0].address); const sliceSido = response.result.items[0].addrdetail.sido.slice(0, 2); setter.setAddressSido(sliceSido); }, );
<S.Map> <NaverMap mapDivId={'maps-getting-started-uncontrolled'} style={{ width: '100%', height: '100%', outline: 'none', }} center={{ lat: latitude, lng: longitude }} defaultZoom={13} onClick={handleMarkerPosition} > <Marker key={1} position={{ lat: latitude, lng: longitude }} animation={0} /> ); </NaverMap> <MapAddressBox address={address} setLatitude={setLatitude} setLongitude={setLongitude} /> </S.Map>