I want to click a link with a search string. But the react router does not direct to that page. After refresh the page gets loaded. Is something wrong?
URL
http://localhost:3000/landing?cars
Link button
<Button
component={Link}
to={{pathname: "/landing?cars"}}
>
Cars
</Button>
router
<Switch>
<Route path="/landing" component={Landing} />
...
</Switch>
to="/landing?search=cars"<Route path="/landing/:search" component={Landing} />andto="/landing/cars". Then in landing page you can useconst {search} = useParams(). But first make sure to import it fromconst { useParams } from 'react-router-dom'queryorparam