Adding Navigation Bar To React App Using React-Bootstrap
Adding Navigation Bar To React App Using React-Bootstrap
I am saving this post for my own future reference and other new react enthusiasts who
might find it useful. By no means Im an expert on react. However, I hope you will avoid the
hours of confusion (this could be a good movie title) I had to go through.
In choosing frontend components among others, we have 4 main competing options. These
are bootstrap, foundation, react-bootstrap and reactstrap. In this article you will find the
comparison of these options.
This choice seems a comparison between Coca Cola and Pepsi. I personally prefer Coca
Cola. Coca Cola and Pepsi must have different characteristics that make them preferred by
their respective customers. As I am trying to learn react, I want to use react-bootstrap,
which is javascript reimplementation of bootstrap 3. By far, Bootstrap is the most
commonly used frontend option. So, what are the advantages of react-bootstrap over
bootstrap?
The authors of Learning Web Development with React outline these advantages of react-
bootstrap:
Installing react-bootstrap
Go to the folder where you created a react-app using the create-react-app command in
node CMD. Use the following command:
This will install the react-bootstrap module in the node_modules of your project folder. For
styling the navbar you also need to install bootstrap.
Also add the react-bootstrap javascript in the <body> section, below <div id="root"></div>
<script rel="stylesheet" type="javascript" href="../node_modules/react-
bootstrap/react-bootstrap.min.js"></script>
export { Header };
Import the class Header from NavigationBar to App.jsx and embed it as <Header
className="Header"/> below <div className="App"> .
I hope I had saved you some time in figuring react-bootstrap navbar component.