How to achieve in page navigation in Next.js

Viewed 315

Hello guys I am trying to navigate using a router in NextJs.

And while routing to the next page I want to route to a specific location on the age that why I am using Id and #

router.push('/patient/details#identity'); // This code works but not able to pass query parameter

BELOW CODE NOT WORKED

When I used the below code it did not work properly and give me this :http://localhost:8081/patient/details%23identity

there is no #identity in route

    router.push({
      pathname: '/patient/details#identity'
    });

When I used the below code it did not work properly and give me this http://localhost:8081/patient/search?patientId=110588&storeNbr=5525

there is no #identity in route

    router.push({
      pathname: '/patient/details#identity'
      query: { patientId: item.patientId, storeNbr: item.storeNbr },
    });

OR

    router.push('/patient/details#identity', {
      query: { patientId: item.patientId, storeNbr: item.storeNbr },
    });
0 Answers
Related