是否可以将存储在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 `{}`