File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ Try a demo of the example code below here:
2626
2727### [ Demo on CodeSandbox] ( https://codesandbox.io/s/charming-herschel-7z362 )
2828
29- ## ` getInitialProps ` cookies (SSR + Client)
29+ ## ` getServerSideProps ` cookies (SSR + Client)
3030
3131``` js
3232import { parseCookies , setCookie , destroyCookie } from ' nookies'
@@ -47,12 +47,12 @@ export default function Me({ cookies }) {
4747 )
4848}
4949
50- Me . getInitialProps = async function ({ ctx }) {
50+ export async function getServerSideProps ({ ctx }) {
5151 // Parse
5252 parseCookies (ctx)
5353
5454 // Set
55- setCookie (ctx, ' fromGetInitialProps ' , ' value' , {
55+ setCookie (ctx, ' fromGetServerSideProps ' , ' value' , {
5656 maxAge: 30 * 24 * 60 * 60 ,
5757 path: ' /' ,
5858 })
@@ -73,7 +73,7 @@ export default function Me () {
7373 return < div> My profile< / div>
7474}
7575
76- Me . getInitialProps = async function ({ ctx }) {
76+ export async function getServerSideProps ({ ctx }) {
7777 // Parse
7878 nookies .get (ctx)
7979
You can’t perform that action at this time.
0 commit comments