The index page uses "getInitialProps" to load data. Then we create a dialog which can create a new data. After creating a new data, the current page should be reloaded.
We use Router.replace('/')
to reload the page. But it triggers a server-side rendering.
What we need is a client-side reload. The "getInitialProps" function should be called in the browser. So, how to do the client-side reload?
Assume, a user is on the
http://www.example.com/profile
the user has edited the profile and for some reason, you need to reload the same page.
If your case is similar to this, you could use Router.reload();
Remember, you must import Router object like this import Router from "next/router";
For more information: https://nextjs.org/docs/api-reference/next/router#routerreload