是否可以将存储在localStorage或Cookies中的详细信息传递到nextjs中的getStaticPaths和



是否可以将存储在localStorage或Cookie中的信息传递给next中的getStaticPaths和getStaticProps,保存我需要的内容数据的API需要我传入当前日志中的用户id才能获取我想要的数据

getStatisPaths和getStaticProps在构建时运行。你不能使用cookie。您可以使用getServerSideProps。

在getServerSideProps-中提供req中间件

传递给getServerSideProps的上下文中的req提供了解析传入请求(req(的内置中间件。该中间件是:

`req.cookies` - An object containing the cookies sent by the request. Defaults to `{}`

相关内容

最新更新