Last active
March 29, 2019 19:49
-
-
Save isacjunior/03489360e04703cfa2f3d463503edc9e to your computer and use it in GitHub Desktop.
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
import React, { Component } from 'react' | |
interface State { | |
name: string | |
} | |
class DidUpdate extends Component<{}, State> { | |
state = { | |
name: '' | |
} | |
componentDidMount() { | |
console.log('Eu estou montado') | |
} | |
componentDidUpdate() { | |
console.log('Sofri alteração') | |
} | |
handleChange = (e: React.ChangeEvent<HTMLInputElement>) => | |
this.setState({ name: e.target.value }) | |
render() { | |
const { name } = this.state | |
return ( | |
<> | |
<input value={name} onChange={this.handleChange} /> | |
</> | |
) | |
} | |
} | |
export default DidUpdate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment