call(back)

Build a Counter

Build a counter component. The buttons are already on screen — make them work.

Requirements

  • +1 and -1 change the displayed count.
  • The count never goes below zero: -1 is disabled at 0.
  • Reset returns the count to 0.

Talk through where the state lives and why the disabled state should be derived from it rather than stored separately.

Asked at