Router.push URL: new query string value to an existing asPath or update the existing query string #16228
-
I am kinda lost on how the NextJS router system works: I have articles by categories that can be:
I am having a navbar where the user can display articles by category, and can also search by a keyword. The category feature is working perfectly. This is how my navbar looks like: That means if the user clicks on Here is the scenario:
PROBLEMI now want to combine categories and search: After getting the search result, when the user changes the keyword, I want to replace the HOW I TRIED TO DO?I know NextJS router object has:
But doing so is encoding the So, I don't even know if I can replace the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I solved the issue by not using the
|
Beta Was this translation helpful? Give feedback.
-
Something wrong here??? |
Beta Was this translation helpful? Give feedback.
I solved the issue by not using the
asPath
: I instead used thepathname
alongside the spread operator as follow: