1. First, we need fresh reactjs setup, and for that, we need to run below commands into out terminal, and also we should have latest node version installed on our system:
npx create-react-app my-awesome-project
cd my-awesome-project
npm start
2. Now we need to run below commands into our project terminal to get bootstrap and related modules into our reactjs application:
npm install [email protected] --save
npm start //For start project again
3. Finally for the main output, we need to add below code into our my-awesome-project/src/App.js file or if you have fresh setup then you can replace my-awesome-project/src/App.js file code with below code:
import React from 'react';
import './App.css';
import 'bootstrap/dist/css/bootstrap.min.css';
function App() {
return (
<div>
<link rel="stylesheet" type="text/css" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css"/>
<div class="container bootstrap snippets bootdey">
<div class="panel panel-info">
<div class="panel-heading">
<h1>
<span class="glyphicon glyphicon-th"></span>
<a class="refresh pull-right" href="#/"><span class="fa fa-refresh"></span></a> <strong>Refresh Widget</strong>
</h1>
</div>
<div class="panel-body panel-refresh">
<div class="refresh-container"><i class="refresh-spinner fa fa-spinner fa-spin fa-5x"></i></div>
<h4>Refresh Me: Please click on the refresh button </h4>
<div class="jumbotron">
This widget utilizes the simple <strong>$.refreshMe()</strong> plugin!
</div>
<div class="refresh-data">
This is the original data that will update upon refresh..
</div>
</div>
</div>
</div>
</div>
);
}
export default App;
4. Now we need to add below code into our my-awesome-project/src/App.css file :
.panel-refresh {
height:250px;
position:relative;
}
.refresh-container {
position:absolute;
top:0;
right:0;
background:rgba(200,200,200,0.25);
width:100%;
height:100%;
display: none;
text-align:center;
z-index:4;
}
.refresh-spinner {
padding: 30px;
opacity: 0.8;
}