Skip to content

Instantly share code, notes, and snippets.

@misss-popcorn
Created October 25, 2020 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save misss-popcorn/35f28af58c492910d3c968e7a86e9033 to your computer and use it in GitHub Desktop.
Save misss-popcorn/35f28af58c492910d3c968e7a86e9033 to your computer and use it in GitHub Desktop.
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