본문 바로가기
개발/React Native

2.8 Weather

by 세크레투스 2023. 6. 2.
반응형
SMALL

1. ActivityIndicator

ReactNative 개발 웹페이지에 가면 있는, 로딩 시 빙글빙글 돌아가는 UI를 보여주는 컴포넌트이다.

 

날씨API는 https://openweathermap.org/ 에서 회원가입 후 무료 API를 받아올 것이다.

 

Сurrent weather and forecast - OpenWeatherMap

Access current weather data for any location on Earth including over 200,000 cities! The data is frequently updated based on the global and local weather models, satellites, radars and a vast network of weather stations. how to obtain APIs (subscriptions w

openweathermap.org

Daily Forecast 16 Days에서 API를 가져올 것이다.

 

API를 불러오는 방법은 다음과 같다.

const response = await fetch(`https://api.openweathermap.org/data/3.0/onecall?lat={lat}&lon={lon}&exclude={part}&appid={API key}`);

{} 부분에 각각 넣어야 할 내용들을 넣어주면 된다.

상수 혹은 변수 값을 넣어줄 땐 ${변수명} 으로 해당 변수를 가져올 수 있다.

 

느낀점 :

component나 개발문서를 보려면 어쨌거나 영어 단어를 잘 알아야지 사용하기 편한 것 같다.

영어공부를 열심히 해야겠다.

 

반응형
LIST

'개발 > React Native' 카테고리의 다른 글

CheckBox 개별 클릭  (0) 2023.06.27
2.10 Icons  (0) 2023.06.03
2.7 Location  (0) 2023.06.02
2.6 Styles part two  (0) 2023.06.01
2.4 Layout System  (0) 2023.05.31