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>
<div class="container bootstrap snippets bootdey">
<div class="row">
<nav class="col-sm-2">
<div class="row">
<div class="col-sm-12">
<img src="https://www.bootdey.com/image/200x200/87CEFA/000000" alt="test" class="img-circle img-responsive center" />
</div>
<ul class="nav nav-pills nav-stacked">
<li class="active"><a href="#/"><span class="glyphicon glyphicon-home"></span> Home</a></li>
<li><a href="#/"><span class="glyphicon glyphicon-cutlery"></span> Recipes</a></li>
<li><a href="#/"><span class="glyphicon glyphicon-user"></span> About</a></li>
<li><a href="#/"><span class="glyphicon glyphicon-envelope"></span> Contact</a></li>
</ul>
</div>
</nav>
<div class="col-sm-10">
<div id="this-carousel-id" class="carousel slide hidden-xs">
<div class="carousel-inner">
<div class="item active">
<img src="https://www.bootdey.com/image/1000x480/FF1493/000000" alt="" />
<div class="carousel-caption">
<p>Caption text here</p>
</div>
</div>
<div class="item">
<img src="https://www.bootdey.com/image/1000x480/00BFFF/000000" alt="" />
<div class="carousel-caption">
<p>Caption text here</p>
</div>
</div>
<div class="item">
<img src="https://www.bootdey.com/image/1000x480/FF1493/000000" alt="" />
<div class="carousel-caption">
<p>Caption text here</p>
</div>
</div>
<div class="item">
<img src="https://www.bootdey.com/image/1000x480/20B2AA/000000" alt="" />
<div class="carousel-caption">
<p>Caption text here</p>
</div>
</div>
</div>
{/* Next and Previous controls below
href values must reference the id for this carousel*/}
<a class="carousel-control left" href="#this-carousel-id" data-slide="prev">‹</a>
<a class="carousel-control right" href="#this-carousel-id" data-slide="next">›</a>
</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 :
body{margin-top:20px;}