Skip to content

Instantly share code, notes, and snippets.

@drwpow
Last active February 22, 2019 18:59
Show Gist options
  • Select an option

  • Save drwpow/31e84c32f91ecb6d7b57fbb63b0110aa to your computer and use it in GitHub Desktop.

Select an option

Save drwpow/31e84c32f91ecb6d7b57fbb63b0110aa to your computer and use it in GitHub Desktop.
class HomePage extends React.Component {
static getInitialProps() {
// This only fires on the first SSR pass
}
componentDidMount() {
// This only fires in the client, when mounted (not on SSR)
}
}
@kochis
Copy link
Copy Markdown

kochis commented Feb 22, 2019

getInitialProps does not just fire on the server. It will also fire on the client when navigating between pages on client-side (using the next-router)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment