Last active
October 17, 2018 21:39
-
-
Save mkamakura/81d8aaf298690421fe0f60546fc1d348 to your computer and use it in GitHub Desktop.
Inject page title with Nextjs
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
/* @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