Help with React Router 😫
Chantae P.

Chantae P. @taepal467

About: Hello, my name is Chantae. I use this platform to talk about my journey of getting into tech.

Location:
Los Angeles CA
Joined:
Dec 3, 2020

Help with React Router 😫

Publish Date: Jan 25 '23
1 2

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

 <BrowserRouter basename="/shopping_cart">
....
<BrowserRouter/>
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!

Comments 2 total

  • Gisele Leonardi
    Gisele LeonardiJan 25, 2023

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

    • Chantae P.
      Chantae P.Jan 25, 2023

      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.

Add comment