Skip to content

Instantly share code, notes, and snippets.

Created April 7, 2017 18:05
Show Gist options
  • Save anonymous/c03c80149a193611e0729319c8f78e74 to your computer and use it in GitHub Desktop.
Save anonymous/c03c80149a193611e0729319c8f78e74 to your computer and use it in GitHub Desktop.
import Layout from '../components/Layout';
class SSRTest extends React.Component {
static async getInitialProps ({req}) {
return req
? { from: 'server' } // 서버에서 실행 할 시
: { from: 'client '} // 클라이언트에서 실행 할 시
}
render() {
return (
<Layout>
{this.props.from} 에서 실행이 되었어요.
</Layout>
);
}
}
export default SSRTest;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment