Created
July 26, 2017 23:02
-
-
Save scottdomes/bf17ec52fca4e8e0711bfd6720351f76 to your computer and use it in GitHub Desktop.
docs-clone
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, { Component } from 'react' | |
import './App.css' | |
class App extends Component { | |
state = { text: '' } | |
componentDidMount() { | |
window.fetch('http://localhost:3001/notes/1').then(data => { | |
data.json().then(res => { | |
this.setState({ text: res.text }) | |
}) | |
}) | |
} | |
handleChange = e => { | |
this.setState({ text: e.target.value }) | |
} | |
render() { | |
return ( | |
<textarea | |
value={this.state.text} | |
onChange={this.handleChange} | |
/> | |
) | |
} | |
} | |
export default App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment