Skip to content

Instantly share code, notes, and snippets.

@junaidrahim
Created March 16, 2020 14:18
Show Gist options
  • Save junaidrahim/0284731335f66b21caeb7f21b7809001 to your computer and use it in GitHub Desktop.
Save junaidrahim/0284731335f66b21caeb7f21b7809001 to your computer and use it in GitHub Desktop.
React Loader Example 2
import React, { useState } from "react";
import Loader from "react-loader-spinner";
const App = () => {
const [spinnerLoading, setSpinnerLoading] = useState(true);
return (
<div style={{ textAlign: "center" }}>
<br></br>
<br></br>
<Loader
type="Puff"
color="#00BFFF"
height={100}
width={100}
visible={spinnerLoading}
/>
<br></br>
<button onClick={() => setSpinnerLoading(!spinnerLoading)}>Toggle Loader</button>
</div>
)
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment