React-router is client-side routing. You're not making an HTTP request, so there's no status code to set. If you're doing server-side rendering that's a different story but as it stands you can't accomplish what you're wanting and frankly I'm not sure why you would want to.
this post was submitted on 30 Jul 2023
8 points (90.0% liked)
React
914 readers
1 users here now
A community for discussing anything related to the React UI framework and it's ecosystem.
Wormhole
Icon base by Skoll under CC BY 3.0 with modifications to add a gradient
founded 1 year ago
MODERATORS
Oh I see my mistake, thank you for explaining it!
No problem. Is there something you were trying to accomplish with the 404?
Well coming from a non react web land, i figured if its a non existent page, it should throw a 404 status. It didn't occur to me to check if its even making a request beyond initial load (which was where i was seeing 200's from and getting confused)