Skip to content

Instantly share code, notes, and snippets.

@zettca
Created January 21, 2018 05:02
Show Gist options
  • Save zettca/a4d48d38973ca5c35b44d0348385efd0 to your computer and use it in GitHub Desktop.
Save zettca/a4d48d38973ca5c35b44d0348385efd0 to your computer and use it in GitHub Desktop.
These are the things that keep me awake at night
this.state = ['time', 'distance', 'pace'].reduce((obj, el) => {
obj[el] = { value: values[el], enabled: type !== el };
return obj;
}, {});
this.state = {
time: {
value: values.time,
enabled: type !== 'time'
},
distance: {
value: values.distance,
enabled: type !== 'distance',
},
pace: {
value: values.pace,
enabled: type !== 'pace',
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment