You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So my question is: can I use getServerSideProps instead of getInitialProps for the custom error page? I'm not really sure about this since getServerSideProps doesn't receive the prop err through context, so getInitialProps is the only way?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there,
I'm customizing the error page of my Next.js app. The code in the doc indicates to use
getInitialProps
to handle SSR errors properly. However, the official doc also encourage to usegetServerSideProps
instead ofgetInitialProps
in general.So my question is: can I use
getServerSideProps
instead ofgetInitialProps
for the custom error page? I'm not really sure about this sincegetServerSideProps
doesn't receive the properr
throughcontext
, sogetInitialProps
is the only way?Thanks.
Beta Was this translation helpful? Give feedback.
All reactions