Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

react
loading spinner

How to create a loading spinner in React

Educative Answers Team

In react, animated spinners are often used to make web-pages more attractive. The steps are:

  1. Install the package using the command prompt.
npm install react-bootstrap bootstrap
  1. Import spinner module from the above package.
import { Spinner } from 'react-bootstrap';
  1. Use the <Spinner> tag for the spinner – you can apply CSS styles to it.

Remember to use the latest version of react and react-bootstrap.

Code

import React from 'react';
require('./style.css');

import ReactDOM from 'react-dom';
import App from './app.js';

ReactDOM.render(
  <App />, 
  document.getElementById('root')
);

RELATED TAGS

react
loading spinner
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring