<div class="weather"></div>
<script>
const weatherElement = document.querySelector(".weather");
const getSeoulWeather = async () => {
const API_KEY = "";
const LAT = 37.5683;
const LON = 126.9778;
const API_URL = `https://api.openweathermap.org/data/2.5/weather?lat=${LAT}&lon=${LON}&appid=${API_KEY}`;
try {
const response = await fetch(API_URL);
if (!response.ok) {
throw new Error("날씨 정보를 가져오는데 실패했습니다.");
}
const data = await response.json();
const weather = data.weather[0]?.main;
const temperature = Math.round(data.main.temp - 273.15);
weatherElement.textContent = `날씨: ${weather}, 온도: ${temperature}°C`;
} catch (error) {
console.log("날씨 정보를 가져오는데 실패했습니다.", error);
weatherElement.textContent = "날씨 정보를 가져오지 못했습니다.";
}
};
getSeoulWeather();
</script>
<script src="https://unpkg.com/react@17.0.2/umd/react.production.min.js"></script>
<script src="https://unpkg.com/react-dom@17.0.2/umd/react-dom.production.min.js"></script>
<script type="text/babel">
const root = document.getElementById('root')
function MyComponent(props) {
return React.createElement('h1', null, `안녕하세요 ${props.name}`);
};
ReactDOM.render(<MyComponent name={"yulgok"} />, root);
</script>
gitHub : https://github.com/leeyulgok/3-Day-2/tree/main/%EC%8B%A4%EC%8A%B5
const onLogin = (event) => {
event.preventDefault();
console.log(event.target.parentElement.id.value);
console.log(event.target.parentElement.pw.value);
};
본 후기는 유데미-스나이퍼팩토리 10주 완성 프로젝트캠프 학습 일지 후기로 작성 되었습니다.
#프로젝트캠프 #프로젝트캠프후기 #유데미 #스나이퍼팩토리 #웅진씽크빅 #인사이드아웃 #IT개발캠프 #개발자부트캠프 #리액트 #react #부트캠프 #리액트캠프