0

how to create a Protected Route if I wrote route in the way: I am use 6.4.3 version react-router-dom.

const router = createBrowserRouter([
    {
      path: "/",
      element: <Root />,
      errorElement: <ErrorPage />,
      loader: rootLoader(queryClient),
      action: rootAction(queryClient),
      children: [
        {
          index: true,
          element: <Index />
        },
        {
          path: "contacts/:contactId",
          element: <Contact />,
          loader: contactLoader(queryClient),
          action: contactAction(queryClient),
        },
      ],
    },
  ],
);
6899 huge
  • 198
  • 2
  • 12

0 Answers0