Skip to content

Instantly share code, notes, and snippets.

@gpDA
Created May 2, 2019 15:42
Show Gist options
  • Save gpDA/3042c849793364f36d30ff28feb75b3e to your computer and use it in GitHub Desktop.
Save gpDA/3042c849793364f36d30ff28feb75b3e to your computer and use it in GitHub Desktop.
// ./components/Chart/Chart.js
// APPEND the updated new value to the end of state
// increment counter
updateArray(){
this.setState({
inital_line_1: [
...this.state.inital_line_1,
this.props.counters[0].value
],
inital_line_2: [
...this.state.inital_line_2,
this.props.counters[1].value
],
inital_line_3: [
...this.state.inital_line_3,
this.props.counters[2].value
],
counter: this.state.counter + 1
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment