Last active
July 10, 2018 21:07
-
-
Save marensas/236c04839db4e5d0e5c07f5ba0096ad6 to your computer and use it in GitHub Desktop.
App with getData()
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"; | |
class App extends React.Component { | |
constructor (props) { | |
super(props); | |
this.state = { | |
data: [], | |
currentTicket: 0, | |
finished: false, | |
score: '', | |
}; | |
} | |
componentDidMount() { | |
this.getData(); | |
} | |
getData = () => { | |
fetch('/tickets.json').then((response) => { | |
return response.json(); | |
}).then((data) => { | |
this.setState({ data }); | |
}); | |
} | |
render () { | |
return ( | |
<h1>Testas</h1> | |
); | |
} | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment