Created
December 29, 2020 12:33
-
-
Save naveedahmed986/30e128d5cf614675ffe4e9b1924fd334 to your computer and use it in GitHub Desktop.
react-loading-overlay hook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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