Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from 'react';
- export default title => ChildComponent =>
- class TitleChanger extends Component {
- constructor(props) {
- super(props);
- this.state = {
- oldTitle: document.title,
- };
- }
- componentDidMount() {
- document.title = title;
- }
- componentWillUnmount() {
- document.title = this.state.oldTitle;
- }
- render() {
- return <ChildComponent />;
- }
- };
Add Comment
Please, Sign In to add comment