Skip to content

Instantly share code, notes, and snippets.

@mkamakura
Last active October 17, 2018 21:39
Show Gist options
  • Save mkamakura/81d8aaf298690421fe0f60546fc1d348 to your computer and use it in GitHub Desktop.
Save mkamakura/81d8aaf298690421fe0f60546fc1d348 to your computer and use it in GitHub Desktop.
Inject page title with Nextjs
/* @flow */
import React, { Component } from 'react'
import Head from 'next/head'
export default (title: string) => (ComposedComponent: any) => class HeadTitle extends Component<Object> {
render () {
return [
<Head key='head'><title>{title}</title></Head>,
<ComposedComponent key='composedComponent' {...this.props} />,
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment