While working on my nextJS application, I encountered an error in the page file:
warn - You should not access 'res' after getServerSideProps resolves.
Read more: https://nextjs.org/docs/messages/gssp-no-mutating-res
I tried reading the provided link but couldn't grasp its meaning. What does it imply when it says
This object is not intended to be accessed or changed after getServerSideProps() resolves
? As far as I know, there is no 'after' in this context...
Can anyone shed some light on what might be going wrong?
[hash].tsx
export const getServerSideProps: GetServerSideProps = async ({
res,
query: { hash }
}) => {
// Function logic here...
}
const HashPage: NextPage = () => {
return (
<ThemeProvider theme={theme}>
<Head>
<title>Title</title>
</Head>
</ThemeProvider>
)
}
export default HashPage
_document.tsx
class Document extends NextDocument {
render() {
// Render logic here...
}
Document.getInitialProps = async (ctx) => {
// Initial Props logic here...
}
export default Document