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>
<hr/>
<div class="container bootstrap snippets bootdey">
<div class="row">
<div class="col-md-6">
<div class="row">
<div class="col-md-12 text-center">
<img src="https://bootdey.com/img/Content/avatar/avatar6.png" class="img-polaroid profile-img img-thumbnail " />
</div>
<div class="col-md-12 text-center">
<div class="row">
<div class="col-md-12">
<div class="alert alert-success pull-right hide">
<button type="button" class="close" data-dismiss="alert">×</button>
You gave a rating of <span id="count">0</span> star(s)
</div>
</div>
</div>
<div class="row">
<div class="col-md-12 text-center">
<h2 class="text-primary"><span class="glyphicon glyphicon-user"></span>John Doe<p class="lead">Please click the stars to vote</p></h2>
</div>
</div>
<div class="row lead">
<div class="col-md-12 text-center">
<div id="stars" class="starrr text-warning"></div>
</div>
</div>
</div>
</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 :
.profile-img{box-shadow: 0 5px 15px rgba(0,0,0,.5)}