Skip to content

Commit

Permalink
Docs: Add useful link to invalid-getstaticprops-value error message (#…
Browse files Browse the repository at this point in the history
…35915)

## Documentation / Examples

- [x] Make sure the linting passes by running `yarn lint`

I would like to add useful link to `getStaticProps` invalid return value error message as currently there is no useful link being provided. I believe that this might improve the developer experience.
  • Loading branch information
samueldusek committed Apr 5, 2022
1 parent b1a7b88 commit 739e6f0
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions errors/invalid-getstaticprops-value.md
Expand Up @@ -8,14 +8,18 @@ In one of the page's `getStaticProps` the return value had the incorrect shape.

Make sure to return the following shape from `getStaticProps`:

```js
```ts
export async function getStaticProps(ctx: {
params?: ParsedUrlQuery
preview?: boolean
previewData?: PreviewData
params?: ParsedUrlQuery;
preview?: boolean;
previewData?: PreviewData;
}) {
return {
props: { [key: string]: any }
}
return {
props: { [key: string]: any }
}
}
```

### Useful Links

- [`getStaticProps` Documentation](https://nextjs.org/docs/api-reference/data-fetching/get-static-props)

0 comments on commit 739e6f0

Please sign in to comment.