'Can getStaticProps() use .then syntax in Next.js?
I am reading the Next.js documentation and see the following example for using getStaticProps()
export async function getStaticProps() {
// Get external data from the file system, API, DB, etc.
const data = ...
// The value of the `props` key will be
// passed to the `Home` component
return {
props: ...
}
}
Wherever I look, I've only see export async function getStaticProps() despite the fact that Promises with .then syntax should work just as well. Does Next enforce the async/await syntax or is it possible to use chained Promises with .then?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
