I'm setting up a project where I need to have a nested route "/user/:id" where the id is serves as a parameter that I can pass in.
In development mode everything (all components, static assets, etc.) loads properly. However, when I build the react project and serve it in production mode, some of the images are not being loaded and looking for the assets on some nested route off the root domain. (I don't fully understand how react grabs the files to be served, but I've attached images that might give insight into this predicament.) The error in grabbing the assets occur when I visit any site off of the "user" path e.g. /user/234, /user/23, etc.
Below is an
Thank you!



Turns out that all I needed to do was add <base href="/"> to the head of my index.html file!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With