DEV Community

Chantae P.
Chantae P.

Posted on

Help with React Router 😫

** Update: as of 1/25 I fixed the issue!!!! I had to add the 'basename' attribute to BrowserRouter:**

 <BrowserRouter basename="/shopping_cart">
Enter fullscreen mode Exit fullscreen mode

Here's the live site

I am currently working on The Odin Projects "Shopping Cart" Assignment. Right now I am stuck on the Router section.

When I'm opening the project in VS code and using npm start to launch the application, this is how my screen looks:
When first opening the web application and this is my terminal after entering npm start
starting the application

For me to access the home page, I need to edit the url like so:
After manually removing 'shopping cart' from the URL

I'm trying to figure out what I did wrong but still don't understand what's going on. Here's my github repository. Any help is greatly appreciated. Thank you!

Top comments (2)

giseleml profile image
Gisele Leonardi

That's because on your package.json the homepage attribute is set with "/shopping_cart". Remove that and it should work just fine.

taepal467 profile image
Chantae P.

Thank you for responding!
I did try removing the '/shopping_cart' from the homepage attribute. It DID work when I'm building the project. But when I push my changes to github, the page is still blank.
Here's the live site with the changes made.