Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

react-loader-spinner

import React from 'react';
import "react-loader-spinner/dist/loader/css/react-spinner-loader.css";
import Loader from "react-loader-spinner";
import '../style.css';
const LoaderComponent = () => {
    return (
        <div className="loader">
            <Loader
                type="Circles"
                color="#dc1c2c"
                height={50}
                width={100}
                //timeout={1000} //3 secs
            />
        </div>
    );
};

export default LoaderComponent;

style.css
===
.loader {
  position: fixed;
  width: 100vw;
  height: 100vh;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  animation: bg 1s;
}
Comment

install react spinner

npm install --save react-spinners
Comment

react spinkit

$ npm install react-spinkit --save
Comment

react spinner

import { useState, CSSProperties } from "react";
import ClipLoader from "react-spinners/ClipLoader";

const override: CSSProperties = {
  display: "block",
  margin: "0 auto",
  borderColor: "red",
};

function App() {
  let [loading, setLoading] = useState(true);
  let [color, setColor] = useState("#ffffff");

  return (
    <div className="sweet-loading">
      <button onClick={() => setLoading(!loading)}>Toggle Loader</button>
      <input value={color} onChange={(input) => setColor(input.target.value)} placeholder="Color of the loader" />

      <ClipLoader color={color} loading={loading} cssOverride={override} size={150} />
    </div>
  );
}

export default App;
Comment

react-spinners

yarn add react-spinners
Comment

PREVIOUS NEXT
Code Example
Javascript :: react native azure 
Javascript :: custom indicator js tradingview 
Javascript :: react native floating action button 
Javascript :: vue router push with params 
Javascript :: async/await 
Javascript :: display object in array 
Javascript :: javascript Strict Mode in Variable 
Javascript :: How to use await with map in js 
Javascript :: how to add value with useref in react 
Javascript :: javascript only allow numbers 
Javascript :: jest test thunk 
Javascript :: Get position of each element using jquery 
Javascript :: cannon js parent child 
Javascript :: repeat call n times in js 
Javascript :: button ref react 
Javascript :: instagram unfollow console code 
Javascript :: write an array that invokes the alter function in to the array 
Javascript :: setTimeout() Method in javascript 
Javascript :: Select First Element querySelector 
Javascript :: how to disable eval in javascript 
Javascript :: how to check if element is in viewport javascript 
Javascript :: how to use of socket io on a route in nodejs 
Javascript :: how to mouse hover svg 
Javascript :: identity-obj-proxy not working 
Javascript :: jquery if today is friday 
Javascript :: react useeffect hook 
Javascript :: nuxt history back 
Javascript :: write a javascript code to display multiplication table in table 
Javascript :: Highlight current nav link in react 
Javascript :: math.random 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =