Skip to content

Instantly share code, notes, and snippets.

@brookslybrand
Last active January 25, 2019 16:58
Show Gist options
  • Select an option

  • Save brookslybrand/3563e9942f51b1cd9fe16d2b3cecdd0c to your computer and use it in GitHub Desktop.

Select an option

Save brookslybrand/3563e9942f51b1cd9fe16d2b3cecdd0c to your computer and use it in GitHub Desktop.
// sets the name in the store and in the state hook
const setName = id => value => {
// update the store
db.formData.put({ id, value })
// update the state hook
setNames(prevNames => ({ ...prevNames, [id]: value }))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment