Skip to content

Instantly share code, notes, and snippets.

@naveedahmed986
Created December 29, 2020 12:33
Show Gist options
  • Save naveedahmed986/30e128d5cf614675ffe4e9b1924fd334 to your computer and use it in GitHub Desktop.
Save naveedahmed986/30e128d5cf614675ffe4e9b1924fd334 to your computer and use it in GitHub Desktop.
react-loading-overlay hook
import {useState} from 'react'
import LoadingOverlay from 'react-loading-overlay'
import './App.css';
function App() {
const [isActive, setIsActive] = useState(false)
return (
<LoadingOverlay
active={isActive}
spinner
text='Loading...'
>
<div className="App">
<button onClick={()=> {
setIsActive(true)
setTimeout(()=>{
setIsActive(false)
},2000)
}}>Load Spinner</button>
</div>
</LoadingOverlay>
);
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment