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">
<div class="col-md-12 text-center text-primary"><h3>Interact with the elements of lists</h3></div>
</div>
<hr/>
<div class="row">
<div class="col-sm-4 col-sm-offset-1">
<div class="list-group" id="list1">
<a href="#/" class="list-group-item active"><span class="glyphicon glyphicon-th-large"></span>List 1 <input title="toggle all" type="checkbox" class="all pull-right"/></a>
<a href="#/" class="list-group-item">Second item <input type="checkbox" class="pull-right"/></a>
<a href="#/" class="list-group-item">Third item <input type="checkbox" class="pull-right"/></a>
<a href="#/" class="list-group-item">More item <input type="checkbox" class="pull-right"/></a>
<a href="#/" class="list-group-item">Another <input type="checkbox" class="pull-right"/></a>
</div>
</div>
<div class="col-md-2 v-center">
<button title="Send to list 2" class="btn btn-default center-block add"><i class="glyphicon glyphicon-chevron-right"></i></button>
<button title="Send to list 1" class="btn btn-default center-block remove"><i class="glyphicon glyphicon-chevron-left"></i></button>
</div>
<div class="col-sm-4">
<div class="list-group" id="list2">
<a href="#/" class="list-group-item active"><span class="glyphicon glyphicon-th-large"></span>List 2 <input title="toggle all" type="checkbox" class="all pull-right"/></a>
<a href="#/" class="list-group-item">Alpha <input type="checkbox" class="pull-right"/></a>
<a href="#/" class="list-group-item">Charlie <input type="checkbox" class="pull-right"/></a>
<a href="#/" class="list-group-item">Bravo <input type="checkbox" class="pull-right"/></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{
background:#ddd;
}
.v-center {
min-height:200px;
display: flex;
justify-content:center;
flex-flow: column wrap;
}