-
-
Save sllvn/0bb5f5e88718944f514b99c064be64b1 to your computer and use it in GitHub Desktop.
This file contains 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
import React from 'react' | |
import Helmet from 'react-helmet' | |
const mapTitleFromProps = WrappedComponent => props => { | |
let definedTitle | |
if (typeof props.route.title === 'function') { | |
definedTitle = props.route.title(props) | |
} else if (typeof props.route.title === 'string') { | |
definedTitle = props.route.title | |
} | |
const title = definedTitle ? `${definedTitle} | Nomos` : 'Nomos' | |
return ( | |
<span> | |
<Helmet title={title} /> | |
<WrappedComponent {...props} /> | |
</span> | |
) | |
} | |
export default mapTitleFromProps |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment