alexa
Facebook
Twitter
LinkedIn
Instagram
Whatsapp
Call Now
Quick Inquiry

How to show loading screen with process status with in react.js ? [closed]

How to show loading screen with process status with in react.js ? [closed]

Try This 

 import React, { useState, useEffect } from 'react';
import Spinner from './your-custom-component';

export default MyComponent = () => {
  const [isLoading, setIsLoading] = useState(true); // When the page loads it must be true;
  
  useEffect(() => {
    setIsLoading(false);
  }, []); // Initial render

  const handleUpdate = async () => {
    setIsLoading(true);
    await performAsyncOpHere();
    setIsLoading(false);
  }

  return isLoading? <Spinner /> : <fancy-html />
}

55 0
7

Write a Comments


* Be the first to Make Comment

GoodFirms Badge
GoodFirms Badge

Fix Your Meeting With Our SEO Consultants in India To Grow Your Business Online