I am using NextJS with ExpressJS custom server. ExpressJS set up session cookies for my NextJS app. I can get session information in getInitialProps which works well when I am using server-side routing (like normal page load) but when using client-side routing with next/link Link I cannot get session information. Please suggest how I can get session information stored in cookies when using client-side routing and cookies cannot be accessed on client-side.
You should use ReactJS context which can allow you to pass props from _app page to all components which need session information.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.