silverwolf-x/project / errors /gssp-component-member.mdx
silverwolf-x's picture
download
raw
958 Bytes
---
title: '`getStaticProps` / `getServerSideProps` can not be attached to the page component'
---
## Why This Error Occurred
On one of your page's components you attached either `getStaticProps`, `getStaticPaths`, or `getServerSideProps` as a member instead of as a separate export.
These methods can not be attached in the same way as `getInitialProps` and must be their own export
## Possible Ways to Fix It
Move the method to it's own export from your page.
**Before**
```jsx filename="pages/index.js"
function Page(props) {
return <p>hello world</p>
}
Page.getStaticProps = () => ({
props: {
hello: 'world',
},
})
export default Page
```
**After**
```jsx filename="pages/index.js"
function Page(props) {
return <p>hello world</p>
}
export default Page
export const getStaticProps = () => ({
props: {
hello: 'world',
},
})
```
## Useful Links
- [Data Fetching Docs](/docs/pages/building-your-application/data-fetching)

Xet Storage Details

Size:
958 Bytes
·
Xet hash:
86e6ed3320d095084bd0e1cb99f5a04173d52805dc82bce2014d7e4c88972fa3

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.