Skip to content

Instantly share code, notes, and snippets.

@ajcrites
Created January 8, 2019 14:12
Show Gist options
  • Save ajcrites/b6fbaf12fd72e787514e2f6613e4ab6c to your computer and use it in GitHub Desktop.
Save ajcrites/b6fbaf12fd72e787514e2f6613e4ab6c to your computer and use it in GitHub Desktop.
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