Created
January 8, 2019 14:12
-
-
Save ajcrites/b6fbaf12fd72e787514e2f6613e4ab6c 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
export class TimesTableApp extends React.Component { | |
changeValue = valueName => value => { | |
this.setState({ [valueName]: value }); | |
}; | |
state = { | |
pointCount: 10, | |
timesTable: 2, | |
lineColor: '#000000', | |
setPointCount: this.changeValue('pointCount'), | |
setTimesTable: this.changeValue('timesTable'), | |
setLineColor: this.changeValue('lineColor'), | |
}; | |
render() { | |
return ( | |
<TimesTableContext.Provider value={this.state}> | |
<TimesTable /> | |
<TimesTableControls /> | |
</TimesTableContext> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment