0
 router.push(
        {
          pathname: "/pages/service-request/",
          query: { service: serviceId, city: city,order:orderRes.id,orderservice:res.id },
        },
        "/pages/service-request/"
      ); 

component b: 

export default function ServiceRequest() {
const router = useRouter();
let { service, city, order, orderservice } = router.query;
useEffect(() => {
if (!router.isReady) {
  return;
}
}, [router.isReady]);
return (
<div>
  {orderservice && (
    <Manage
      orderServiceId={orderservice}
      order={order}
      city={city}
      serviceId={service}
    />
  )}
</div> 
);
}

expect when refresh the page can access the queries fgdfghgfhgh fgfdghdthgfjf fd

expect when refresh the page can access the queries

  • That's the expected behaviour. When refreshing the page the URL will not contain your query params, which means the router won't have access to them. Either keep the query params in the URL, or store the params on the client for future access. – juliomalves Jul 01 '23 at 18:56

0 Answers0