Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manage Page Not Found through hoc #3

Closed
bpetetot opened this issue Jan 5, 2018 · 5 comments
Closed

Manage Page Not Found through hoc #3

bpetetot opened this issue Jan 5, 2018 · 5 comments

Comments

@bpetetot
Copy link
Collaborator

bpetetot commented Jan 5, 2018

Display a "page not found" component when router can't match any title prop in routing configuration tree :

Example :

forRoute('HOME', { notFound: Page404 })(App)
@guillaumecrespel
Copy link
Member

guillaumecrespel commented Jan 6, 2018

I think we have only one not found page.
if we define a default TITLE route for error page and not found page on list of routes ?

export const { reducer, enhancer, middleware } = routerForBrowser({
  routes: {
    '/': { title: 'HOME',
      '/500': { title: '500' },
      '/404': { title: '404' },
    },
  },
  basename,
})

And

forRoute('HOME', { 404: 'CUSTOM_404', 500: 'CUSTOM_500' })(App)

to extends default usage ?

@fabienjuif
Copy link
Member

We speak about this solution with @bpetetot .
What does allow the { notFound: Page404 } is to have multiple "not found" pages depending where you are on the graph:

/
  - contacts/
     - Page404Contacts
  - cities/
     - Page404Cities

With your solution @guillaumecrespel, we only have one 404 page in the whole application since title are uniq.

@bpetetot
Copy link
Collaborator Author

bpetetot commented Jan 6, 2018

This issue is more about the "Route Not Found" and not the "404 not found" (the HTTP error due to a network request not found)

When a user types a route that doesn't exist, I want to display an error page and eventually different page, when the route is not found at different levels of the graph (as @fabienjuif said in the previous post)

@fabienjuif
Copy link
Member

Yes you are write about the definition :)

@fabienjuif
Copy link
Member

see #41

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants