1

I have the following route structure:

const CustomRoute = ({ Component, path, url }) => {
  if (!document.referrer.length) {
    return <Navigate to={url} />;
  }
  return <Route path={path} element={<Component />} />;
};


<Router basename={config.historyBasename}>
  <Routes>
    <CustomRoute
      Component={Activate}
      url={routes.landingPage}
      path={routes.userActive}
    />
  </Routes>
</Router>

Here I am using it like this. But I am getting an error. So, How can I fix this?

Alexander Nied
  • 12,804
  • 4
  • 25
  • 45
ganesh kaspate
  • 1
  • 9
  • 41
  • 88
  • 1
    I think this is a duplicate of [Error: \[PrivateRoute\] is not a component. All component children of must be a or ](https://stackoverflow.com/questions/69864165/error-privateroute-is-not-a-route-component-all-component-children-of-rou). Basically custom route components are no longer allowed as direct children of `` in v6, but there are alternate approaches that are still relatively elegant-- check that link for more details. – Alexander Nied Nov 18 '22 at 16:15

0 Answers0