FrontendArk

Master Frontend Interviews

  • Practice
  • Playground
  • Resource
Medium

Undoable Counter

30 mins

Build a counter component in React that keeps track of its history and allows undo/redo.

Requirements:

  1. Display a counter value.
  2. Include buttons:
    • Increment
    • Decrement
    • Undo (go back to the previous value)
    • Redo (go forward if undo was used)
  3. Maintain a history of all counter values.
  4. Disable undo/redo buttons when they are not applicable.
  5. Focus on functionality over styling.

Code Editor

React Component

00:00
Loading...

Live Preview

See your React component