javascript - Next.js - 您不能将 getInitialProps 与 getServerSideProps 一起使用
问题描述
所以我有一个动态路线/post/[slug]
,想添加包next-i18next
。我将每一页包装在一个 HOC 中,它处理我所有的 GraphQL 内容 ( next-apollo
)。这个 HOC 使用getInitialProps
, 并且next-i18next
想要getStaticProps
(SSG) 或getServerSideProps
(SSR)。但是,Next 不允许getStaticProps
或getServerSideProps
与getInitialProps
.
有解决方法吗?我可以将源代码更改next-apollo
为 SSR 或 SSG 还是静态的?
几个链接:
解决方案
推荐阅读
- google-apps-script - 无法读取 null 的属性“getSheetByName”
- .net-core - 使用 IServiceCollection 注册组件
- html - 如何禁用特定元素的下拉列表
- java - 根据选定的 Maven 配置文件设置应用程序配置
- kotlin-js - 如何导出 Kotlin JS 项目?
- php - 如何在 WooCommerce 中将数据数组从一个挂钩函数传递到另一个函数
- ios - 设备旋转后动画点重新定位
- ruby-on-rails - 为什么发布/创建方法失败并出现错误
- javascript - 如何在javascript中计算配方成分计数器?
- sql - 如何从三个表中提取行