Counter Component

Easy
Free
#State Management

Design and implement a React counter component that maintains a numeric value and allows users to modify it through button interactions. The component should handle state updates and reflect changes immediately in the UI.

Requirements

  • Initialize a state variable count starting at 0
  • Display the current count value within a paragraph element
  • Implement a button with text "Increment" which adds 1 to the current count.
  • Implement a button with text "Decrement" which subtracts 1 from the current count.
  • Ensure the UI updates immediately when either button is clicked

Concepts you'll practice