react-query#useIsFetching TypeScript Examples
The following examples show how to use
react-query#useIsFetching.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.tsx From RareCamp with Apache License 2.0 | 6 votes |
export default function GlobalLoadingIndicator() {
const isFetching = useIsFetching()
const isMutating = useIsMutating()
return isFetching || isMutating ? (
<Progress
style={{ position: 'fixed', top: -12, left: 0, zIndex: 99999 }}
strokeColor={{
from: '#66bb6a',
to: '#5c6bc0',
}}
percent={100}
showInfo={false}
status="active"
/>
) : null
}
Example #2
Source File: FetchingIndicator.tsx From rcvr-app with GNU Affero General Public License v3.0 | 6 votes |
FetchingIndicator: React.FC<Record<string, never>> = () => {
const isFetching = useIsFetching()
return (
<AnimatePresence>
{isFetching && (
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
>
<Base
animate={{ rotate: -360 }}
transition={{ loop: Infinity, ease: 'linear', duration: 0.8 }}
>
<Icon size={4} color="white" icon={ArrowRefresh} />
</Base>
</motion.div>
)}
</AnimatePresence>
)
}