Hey guys faced strange Behavior in react app with react-router v7.
I use browser router, and when I call method navigate from useNavigate
I go the correct url and then my search params are disappearing. What can cause this issue?
here are structure of my routes
<BrowserRouter>
<Routes>
<Route path="/" element={<AppWrapper />} >
<Route index element={<Navigate to="home" replace />} />
<Route path="home" element={<HomePage />} />
<Route path="object/:name" element={<ObjectPage />} />
<Route path="agents" element={<ObjectsPage />} />
</Route>
<Route path="*" element={<NotFoundPage />} />
</Routes>
</BrowserRouter>
And in my home page I do next
const handleCategoryClick = (category: string) => {
navigate({
pathname: '/objects',
search: createSearchParams({
category
}).toString()
})
}
Any ideas? Non of the AI recommendations didn’t helped me. Agents page is empty and still it flashes. Funny part is when I click BACK button in browser it goes on page with search params