score:0

<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.8.4/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.8.4/umd/react-dom.production.min.js"></script>


<div id="root"></div>

score:0

// all your state variables
const [state, setState] = useState(null);
.
.
const [isLoading, setIsLoading] = useState(false);

// set all the state variables at the same time
useEffect(() => { 
  setLIsLoading(true); 
  axios.get(url).then(config => {
    setIsLoading(false);
    setState(config);
  )
}) 

if(isLoading) return <div>Loading...</>

return <div>App</div>

Related Query

More Query from same tag