Created
          March 14, 2020 22:06 
        
      - 
      
- 
        Save batuhansahan/97d7ca381ceb0576b1b69b63c668d812 to your computer and use it in GitHub Desktop. 
    hooks5.js
  
        
  
    
      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 from "react"; | |
| export default class App extends React.Component { | |
| constructor(props) { | |
| super(props); | |
| this.state = { | |
| name: "Reactish" | |
| }; | |
| this.handleNameChange = this.handleNameChange.bind(this); | |
| } | |
| componentDidMount() { | |
| document.title = this.state.name; | |
| } | |
| componentDidUpdate() { | |
| document.title = this.state.name; | |
| } | |
| handleNameChange(e) { | |
| this.setState({ | |
| name: e.target.value | |
| }); | |
| } | |
| render() { | |
| return ( | |
| <div> | |
| <div>Name:</div> | |
| <input value={this.state.name} onChange={this.handleNameChange} /> | |
| </div> | |
| ); | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment