【发布时间】:2021-08-04 01:40:04
【问题描述】:
如果我的表达失败,我只是想从这个页面重定向到另一个页面。我阅读了文档,完全按照他们的做法做了,在网上看了他们所做的,我每次都得到这个。
Error: Additional keys were returned from `getServerSideProps`. Properties intended for your component must be nested under the `props` key, e.g.:
return { props: { title: 'My Title', content: '...' } }
Keys that need to be moved: redirect.
Read more: https://err.sh/next.js/invalid-getstaticprops-value
This error happened while generating the page. Any console logs will be displayed in the terminal window.
这是我在页面内的代码
export async function getServerSideProps(req) {
if(req){
return {
redirect: {
permanent: false,
destination: "/"
}
}
}
}
【问题讨论】: