Reader small image

You're reading from  Full Stack Web Development with Remix

Product typeBook
Published inNov 2023
Reading LevelIntermediate
PublisherPackt
ISBN-139781801075299
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Andre Landgraf
Andre Landgraf
author image
Andre Landgraf

Andre is a full stack developer from Germany. He graduated with an MS in Information Systems from the Technical University of Munich and was also awarded an MS in Computer Science from Sofia University in Palo Alto. Andre currently lives in Cupertino, California, and he works as a Software Engineer at LinkedIn. Andre loves learning, writing, and speaking about all things web. In his free time, he tutors aspiring developers and builds for the web.
Read more about Andre Landgraf

Right arrow

Handling page-not-found (404) errors

We can also handle thrown responses in the root ErrorBoundary component. One special case that can only be handled in the root ErrorBoundary component is the page-not-found exception thrown by Remix. Let’s revisit the root error boundary to handle thrown responses at the root level:

  1. Run BeeRich on localhost by executing npm run dev.
  2. Visit a non-existing page such as http://localhost:3000/cheesecake in a new browser window.

    When visiting a non-existing route, Remix throws a response with HTTP status code 404 at the root level. We can use isRouteErrorResponse to render a 404 page using the root error boundary.

  3. Open the root.tsx file in an editor.
  4. Import isRouteErrorResponse from Remix:
    import {  isRouteErrorResponse,  Links,  LiveReload,  Meta,  Outlet,  Scripts,  ScrollRestoration,  useRouteError,} from '@remix-run/react';
  5. Update...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Full Stack Web Development with Remix
Published in: Nov 2023Publisher: PacktISBN-13: 9781801075299

Author (1)

author image
Andre Landgraf

Andre is a full stack developer from Germany. He graduated with an MS in Information Systems from the Technical University of Munich and was also awarded an MS in Computer Science from Sofia University in Palo Alto. Andre currently lives in Cupertino, California, and he works as a Software Engineer at LinkedIn. Andre loves learning, writing, and speaking about all things web. In his free time, he tutors aspiring developers and builds for the web.
Read more about Andre Landgraf