Created
June 11, 2017 08:41
-
-
Save quentin-sommer/0ea73a8769fe40c666faa58850cd0fb3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Page extends React.Component { | |
static async getInitialProps(args) { | |
return { | |
ua: args.req ? args.req.headers['user-agent'] : navigator.userAgent, | |
} | |
} | |
render() { | |
const {ua} = this.props | |
return ( | |
<UserAgentProvider ua={ua}> | |
{/* Rest of Page */} | |
</UserAgentProvider> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment