Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to install react loader spinner

$ npm install react-loader-spinner --save
Comment

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

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 :: pm2 logs on same console 
Javascript :: 7) Change cursor:pointer at checkboxes in java script 
Javascript :: mouse wheel event angular for table 
Javascript :: react route path exact 
Javascript :: javascript .firstordefault 
Javascript :: vue axios post return json data 
Javascript :: reduce object to array javascript 
Javascript :: dropzone add download button addedfile 
Javascript :: make property read-only javascript 
Javascript :: javascript array contains 
Javascript :: hello world in javascript 
Javascript :: Implement stack as an abstract data type using singly linked list and use this ADT for conversion of infix expression to postfix, prefix and evaluation of postfix and prefix expression. 
Javascript :: what does document.getelementbyid return 
Javascript :: loop node list 
Javascript :: navlink activestyle not working 
Javascript :: number to float js 
Javascript :: static js 
Javascript :: how to change icon from play to pause in javascript 
Javascript :: how to find unique values in an array in js using function 
Javascript :: type checking js vscode 
Javascript :: next js custom document 
Javascript :: sliding window algorithm javascript 
Javascript :: how to add element to an object 
Javascript :: serializeobject jquery 
Javascript :: use inline and other styles react native 
Javascript :: how to find last occurrence comma in a string and replace with value in javascript 
Javascript :: get param from url jquery 
Javascript :: angular right click action 
Javascript :: node.js error handling process 
Javascript :: js get browser name and platform 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =