kryptokay / kwallet

0 stars 0 forks source link

Redirect to a "not-found" page when the targeted page doesn't exist #15 #11

Open rmallols opened 6 years ago

rmallols commented 6 years ago

At the moment, we have some valid URLs available:

User sometimes type invalid URLs by mistake (e.g. http://localhost:3000/create-new-walet). At the moment, we're not handling these kind of typos, so users aren't getting the appropriate feedback.

rmallols commented 6 years ago

Technical guidance:

  1. Create a new NotFound component, and return an error message (e.g. Ooops, it looks like this page doesn't exist :() BONUS: As this a very basic component, it may be a good opportunity to start using functional components for simplicity reasons https://hackernoon.com/react-stateless-functional-components-nine-wins-you-might-have-overlooked-997b0d933dbc

  2. Create a new /not-found route on App.js Please use <switch> to ensuring no other routers are matched https://github.com/ReactTraining/react-router/blob/master/packages/react-router/docs/api/Switch.md

  3. Ensure you can access the new route (http://localhost:3000/not-found) while the old routes still work.

  4. Then, on the routing component, redirect to /not-found if no route is matched. https://stackoverflow.com/questions/32128978/react-router-no-not-found-route (Please note we're using React V4)