How to create a multi-page website using React.js ?
In this article, we will see how to create a simple multipage website using React Js.
Approach: We will create a simple website that will have different pages and a navbar. We will create multiple pages Home page, About page, Blog page, Signup page, and Contact page and then we will see how to navigate between those pages. We will be using the following packages and components:
- react-router-dom: react-router-dom is a reactJS package, It enables you to implement dynamic routing in a web page.
- BrowserRouter: It uses the HTML5 history API to keep the UI in sync with the URL.
- Route: Its responsibility is to render UI when its path matches the current URL.
- Switch: It renders the first child Route or Redirects that matches the location.
Below is the step by step implementation:
Step 1: We will start a new project using create-react-app so open your terminal and type: