mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
14 lines
334 B
TypeScript
14 lines
334 B
TypeScript
import React from 'react';
|
|
|
|
export default function useIsInitialLoading(isLoading: boolean | undefined) {
|
|
const [ isInitialLoading, setIsInitialLoading ] = React.useState(Boolean(isLoading));
|
|
|
|
React.useEffect(() => {
|
|
if (!isLoading) {
|
|
setIsInitialLoading(false);
|
|
}
|
|
}, [ isLoading ]);
|
|
|
|
return isInitialLoading;
|
|
}
|