a quick NextJS Question -> Why does getInitialProps is running when a page is being redirected to (using Router.push \\ Router.replace for example), but isn't running on a page refresh? What's the rational behind this?
Thanks!
For the initial page load, getInitialProps will execute on the server only. getInitialProps will only be executed on the client when navigating to a different route via the next/link component or by using next/router.
This means it'll be invoked in Initial Page Load -Refreshes Apply- where it get's executed in the server side, not the client side. As from
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.