Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting an error while importing Loader from 'react-loader-spinner'?

The error I'm getting:

ERROR in ./src/components/Loading.jsx 9:33-39

export 'default' (imported as 'Loader') was not found in 'react-loader-spinner' (possible exports: Audio, BallTriangle, Bars, Circles, CradleLoader, Grid, Hearts, MutatingDots, Oval, Plane, Puff, RevolvingDot, Rings, TailSpin, ThreeDots, Triangle, Watch)

Here is my code:

import React from 'react';
import Loader from 'react-loader-spinner';

export const Loading = () => (
  <div className="flex justify-center items-center ">
    <Loader type="Puff" color="#00BFFF" height={550} width={80} />
  </div>
);
like image 364
user1106925 Avatar asked Sep 30 '26 17:09

user1106925


1 Answers

react-loader-spinner exports various loaders and you can use those loaders directly. And if you want to import all the loaders and use them. You can do it like this.

import * as Loader from "react-loader-spinner";

function App() {
  return <Loader.TailSpin />;
}

or

import {TailSpin} from "react-loader-spinner";

function App() {
  return <TailSpin />;
}

https://codesandbox.io/s/hopeful-herschel-652kq?file=/src/index.js:70-168

like image 149
sakshya73 Avatar answered Oct 02 '26 07:10

sakshya73



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!