Build a counter component in React that keeps track of its history and allows undo/redo.
Requirements:
- Display a counter value.
- Include buttons:
- Increment
- Decrement
- Undo (go back to the previous value)
- Redo (go forward if undo was used)
- Maintain a history of all counter values.
- Disable undo/redo buttons when they are not applicable.
- Focus on functionality over styling.