From dfe1bc70a412b389c1d5f8eb5bd59e24a164c362 Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Sat, 8 Oct 2016 09:23:06 -0700 Subject: [PATCH 1/2] Update Readme.md --- Readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Readme.md b/Readme.md index 714f4865..66bbf326 100644 --- a/Readme.md +++ b/Readme.md @@ -85,7 +85,7 @@ When state, lifecycle hooks or initial data population you can export a `React.C ```jsx import React from 'react' export default class extends React.Component { - async getInitialProps ({ isServer, req }) { + static async getInitialProps ({ isServer, req }) { return isServer ? { userAgent: req.headers.userAgent } : { userAgent: navigator.userAgent } From ee0356c492ee4b1f3ebe6b338e79d38021d7a794 Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Sat, 8 Oct 2016 17:50:09 -0700 Subject: [PATCH 2/2] Update Readme.md --- Readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Readme.md b/Readme.md index 66bbf326..d9dd3092 100644 --- a/Readme.md +++ b/Readme.md @@ -85,8 +85,8 @@ When state, lifecycle hooks or initial data population you can export a `React.C ```jsx import React from 'react' export default class extends React.Component { - static async getInitialProps ({ isServer, req }) { - return isServer + static async getInitialProps ({ req }) { + return req ? { userAgent: req.headers.userAgent } : { userAgent: navigator.userAgent } }