How to create a loading spinner in React
In react, animated spinners are often used to make web-pages more attractive. The steps are:
- Install the package using the command prompt.
npm install react-bootstrap bootstrap
- Import spinner module from the above package.
import { Spinner } from 'react-bootstrap';
- 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')
);
Free Resources
Copyright ©2026 Educative, Inc. All rights reserved