Home > Software engineering >  ReactJS: How to create a multi-page website?
ReactJS: How to create a multi-page website?

Time:05-02

I've started learning ReactJS and I am wondering how to add multiple pages to my site. I have my project and a basic navbar set up. Thanks for all the help!

CodePudding user response:

You can add as many pages in your react app as you wish. But for navigation from one page to other like for example from home or default page to about page you need the help of a package known as react-router-dom. Version 6 is preferable. By using react-router-dom, with the help of BrowserRouter, Routes, Route, Link and to methods, you can navigate from one page to your next page.

Checkout : https://reactrouter.com/docs/en/v6/getting-started/overview https://www.youtube.com/watch?v=UjHT_NKR_gU

CodePudding user response:

There are multiple ways to handle this, the easiest is to use a library that can easily handle this for you, some of the most common ones are:

React Router

Reach Router

Just pick one and follow the tutorials from there.

  • Related