Reactjs – Prevent useEffect until page and api completely loaded
const page = () => { const router = useRouter(); const {data, isLoading} = useGetUser(); useEffect() => ({ if (isLoading) return; if (!data) { router.push('/create-account'); } }, [isLoading, data]) if (isLoading) { return <spinner /> } return ( <Home />…