NextJS router encode query character

Viewed 418

I'm having an issue when i try to open a new page with NextJS router.

I passed my parameter like:

router.push({
  pathname: '/',
  query: { id: '12344567' },
 })

sometimes (like rarely) it will redirect my page to something like

/%3Fid=12344567

It's weird because it's rarely happened and when it does i don't know how to debug it.

1 Answers

its the parsed shape of the url (after translating special characters). %3F is an escape code for ?, which is required when passing a query param.

Example of passing param: BASE_URL/${PARAM}

Example of query passing: BASE_URL/?${QUERY_NAME}=${QUERY_VALUE}

Related