Skip to content

Conversation

taion
Copy link
Contributor

@taion taion commented Jan 4, 2016

Just some documentation per #2834 (comment).

@timdorr
Copy link
Member

timdorr commented Jan 4, 2016

This is cool, but honestly this whole doc needs to be rewritten for clarity.

timdorr added a commit that referenced this pull request Jan 4, 2016
Give some guidance for 404 with catch-all routes
@timdorr timdorr merged commit 8bd74b6 into master Jan 4, 2016
@timdorr timdorr deleted the taion-patch-1 branch January 4, 2016 04:19
@taion
Copy link
Contributor Author

taion commented Jan 4, 2016

I'm like 50/50 on whether this is an anti-pattern to start with. If you're doing server-side rendering, do you even need a catch-all route? Unless the page has a broken link, how do you end up on the catch-all?

@timdorr
Copy link
Member

timdorr commented Jan 4, 2016

Your server routes aren't aware of your client routes. So, you're normally always on a catch-all route when you're doing SSR. You would have to export your routes to your server for it to know which ones are not handled by the client, or maintain a duplicate copy of them, which is definitely an anti-pattern.

@taion
Copy link
Contributor Author

taion commented Jan 4, 2016

Right - so you do a catch-all on the server.

The question is whether you still need a client-side e.g. <Route path="*" component={NotFound} /> – for an app using browser history, that last "no match" branch ought to take care of the 404, and unless you have dead links...

Well, I guess in practice you'll probably want to do something better than "show a JS error" if you have a dead link.

@max-degterev
Copy link

Catch all routes are useful for 2 reasons:

  1. People add random stuff to the URL, they don't necessarily follow links on the website
  2. Usually you have a bunch of styling/components used to build your pages and you want to use your full arsenal on a 404 page too. Therefore need full stack there

@lock lock bot locked as resolved and limited conversation to collaborators Jan 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants