I want to display pages with different states based on different query params in next.js , so that when a user uses a link with query param , It should not show the default page , but based on the state.
For simplicity
Coinsider the home page as localhost:3000
This renders some default text 'Hello user'
If user enters localhost:3000/?name=JohnDoe
This should render Hello JohnDoe.
Things I have tried .
I am able to add the query param using event handler's via next router .
router.push('/?name=JohnDoe)
But I dont know of a solution to set the state when the user enters the page directly using the a link with query params