Hacker News new | past | comments | ask | show | jobs | submit login

I'd also have liked to see destructuring used to set the new state:

    return {
      ...state,
      count,
    }
I realize that it's superfluous when count is the only property on state, but it makes the code both easier to understand and to maintain as state gains new properties over time.



I've more often seen that called "property value shorthand", but it does compliment destructuring


I probably should have said spread. My inner monologue thinks of ... as destructuring, even though I intellectually know they are distinct.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: