Skip to content

Gracefully handle 404 #51

@dev-yakuza

Description

@dev-yakuza

First, thanks for making the great addon. 🙇

Error

Recently, I got the following error when I pressed the link component(react-router-dom).

Unexpected Application Error!
404 Not Found
💿 Hey developer 👋

You can provide a way better UX than this when your app throws errors by providing your own ErrorBoundary or errorElement prop on your route.
Screenshot 2023-09-03 at 20 31 35

Expect

I hope the click action will be shown in the React Router tap without any error.

Repository

I make a repository about this error. So you can see the error when you run the repository.

I executed the following commands to make the repository.

npx create-react-app error --template=typescript
npm install --save react-router-dom storybook storybook-addon-react-router-v6
npx storybook init

And modified the files.

  • .storybook/main.ts
...
  addons: [
    ...
    'storybook-addon-react-router-v6',
  ],
...
  • .storybook/preview.ts
import type { Preview } from '@storybook/react';
import { withRouter } from 'storybook-addon-react-router-v6';

const preview: Preview = {
  decorators: [withRouter],
  parameters: {
    ...
  },
};

I would really appreciate it if you could solve the problem or tell me how to solve it. 🙇

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions