Skip to content

[Bug]: wildcard route may not match in nested data router #9278

@hhshii

Description

@hhshii

What version of React Router are you using?

6.4.0

Steps to Reproduce

live example : https://codesandbox.io/s/crazy-blackwell-v4ghn8?file=/src/App.js

code example:

  const route = createBrowserRouter(
    [
      {
        path: "/",
        element:  <Outlet />,
        children: [
          {
            path: "/user",
            element: <User />
          },
          {
            path: "/test*",
            element: <div>test *</div>
          },
          {
            path: "*",
            element: <div>Not found</div>
          }
        ]
      }
    ],
    {
      // basename: "/"
    }
  );

Expected Behavior

not found route can match when accessing path /

Actual Behavior

When accessing the root path /, Not Found component is not displayed on the page. It is only shown when I visit other unmatched routes (e.g. /notfound)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions