T
TanStack4y ago
blank-aquamarine

history.back() isn't working also the browser back and forward buttons are disabled

const location = new ReactLocation();
<Router
location={location}
routes={[
{
path: '/',
pendingElement: <SuspenseLoader />,
element: async () => <Home />,
onMatch: handleRouteMatch,
},
{
path: 'login',
pendingElement: <SuspenseLoader />,
element: async () => <Login />,
onMatch: handleRouteMatch,
},
{
path: 'create',
pendingElement: <SuspenseLoader />,
element: async () => <CreateAvatar />,
onMatch: handleRouteMatch,
},
]}
>
const location = new ReactLocation();
<Router
location={location}
routes={[
{
path: '/',
pendingElement: <SuspenseLoader />,
element: async () => <Home />,
onMatch: handleRouteMatch,
},
{
path: 'login',
pendingElement: <SuspenseLoader />,
element: async () => <Login />,
onMatch: handleRouteMatch,
},
{
path: 'create',
pendingElement: <SuspenseLoader />,
element: async () => <CreateAvatar />,
onMatch: handleRouteMatch,
},
]}
>
I want to let the user go back to the previous router using the history.back() method but it doesn't work also I noticed I can't do that through the browser navigation it looks like there is now history for this window any help is appreciated. thanks in advance
No description
1 Reply
blank-aquamarine
blank-aquamarineOP4y ago
the problem was that I used replace : true when doing navigation so that led to a history with length === 1

Did you find this page helpful?