[React Query] useIsFetching

gyujae·2022년 9월 9일
0
post-custom-banner

useIsFetching

react query hooks 중 isFetching 갯수 없으면 0

export function Loading(): ReactElement {
  const isFetching = useIsFetching();

  const display = isFetching ? 'inherit' : 'none';

  return (
    <Spinner
      thickness="4px"
      speed="0.65s"
      emptyColor="olive.200"
      color="olive.800"
      role="status"
      position="fixed"
      zIndex="9999"
      top="50%"
      left="50%"
      transform="translate(-50%, -50%)"
      display={display}
    >
      <Text display="none">Loading...</Text>
    </Spinner>
  );
}
export function App(): ReactElement {
  return (
     <QueryClientProvider client={queryClient}>
       <Loading />
       <Routes />
     </QueryClientProvider>
  );
}
post-custom-banner

0개의 댓글