Skip to content

Instantly share code, notes, and snippets.

@ajcrites
Last active January 8, 2019 17:45
Show Gist options
  • Save ajcrites/fabc8f7d11ff8e92530a738ebdb12dcb to your computer and use it in GitHub Desktop.
Save ajcrites/fabc8f7d11ff8e92530a738ebdb12dcb to your computer and use it in GitHub Desktop.
export class TimesTableApp extends React.Component {
changeValue = valueName => value => {
if (isFunction(value)) {
this.setState({ [valueName]: value(this.state[valueName]) });
else {
this.setState({ [valueName]: value });
}
};
...
}
export const TimesTableControls = () => {
...
const play = () => {
playTimer.current = setInterval(() => {
setTimesTable(prevTimesTable => prevTimesTable + 0.1);
}, 100);
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment