Link backward page not working if new link changed query
Unanswered
Serengeti posted this in #help-forum
SerengetiOP
As the title says. If you click a Link component with href something like this "/customers" then inside customers page there is a useEffect that changes the query like this "/customers?customer=1" then you try to go to the previous page it doesn't work.
6 Replies
why are you doing that anyways?
just route with the search param?
and if you have to do it, use router instead of just appending to the url
@Arinji and if you have to do it, use router instead of just appending to the url
SerengetiOP
useEffect(() => {
let p = searchParams.get("pill");
if (p !== "orange" && p !== "blue") {
router.push(`${pathname}?pill=orange`);
}
}, [searchParams]);Im already doing it
no idea then, sorry