해결된 질문
작성
·
72
0
import { useEffect } from "react";
declare const window: typeof globalThis & {
kakao: any;
};
export default function KakaoMapPage(): JSX.Element {
useEffect(() => {
const container = document.getElementById("map");
const options = {
center: new window.kakao.maps.LatLng(33.450701, 126.570667),
level: 3,
};
const map = new window.kakao.maps.Map(container, options);
console.log(map);
}, []);
return (
<>
<script
type="text/javascript"
src="//dapi.kakao.com/v2/maps/sdk.js?appkey=키"
></script>
<div id="map" style={{ width: 500, height: 400 }}></div>
</>
);
}
Error: Hydration failed because the initial UI does not match what was rendered on the server.
Warning: Expected server HTML to contain a matching <div> in <div>.
See more info here: https://nextjs.org/docs/messages/react-hydration-error
카카오 맵 하는데 오류 왜 뜨는건가요??