Created
October 25, 2020 15:26
-
-
Save misss-popcorn/35f28af58c492910d3c968e7a86e9033 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"; | |
export default class UseEffectClass extends React.Component { | |
constructor() { | |
super(); | |
this.state = { | |
name: "Romalia" | |
}; | |
this.handleChange = this | |
.handleChange | |
.bind(this); | |
} | |
componentDidMount() { | |
document.title = this.state.name; | |
} | |
componentDidUpdate() { | |
document.title = this.state.name; | |
} | |
handleChange(e) { | |
this.setState({name: e.target.value}); | |
} | |
render() { | |
return ( | |
<span className="Left"> | |
<p>Class Component</p> | |
<input value={this.state.name} onChange={this.handleChange}></input> | |
</span> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment