내배캠 68일차

라형선·2023년 1월 10일
0

react query

서버요청을 보냈을 때 쿼리 키를 먼저 검색을 한다.
있으면 캐시 메모리에 있는 데이터를 그냥 이용할 수 있게끔 한다.

api가 여러개 일 때
데이터를 불러올 때 까지 로딩 상태로 ActivittIndicator를 실행하고 전부 불러와지면 렌더링 되게 할 것이다.

const getdata = async () =>{await Promise.all([proimse1, promise2, pomise3]).then(value)}

async와 await

async로 되어있는 함수의 리턴값은 언제나 promise이다.
항상 return값이 promise이다.

const getdata = async () =>{await Promise.all([proimse1, promise2, pomise3]);
setIsLoading(false);}

tip) tap 누르면 자동으로 import 된다.

  if (isLoading) {
    return (
      <CityLoader>
        <ActivityIndicator />
      </CityLoader>
    );
  }
  
    const [isOpenModal, setIsOpenModal] = useState(false);


return (

isLoading과
return 사이에는 아무것도 넣지 않는 것 이 좋다.

profile
형선

0개의 댓글

관련 채용 정보

Powered by GraphCDN, the GraphQL CDN