This question evaluates a candidate's front-end development and real-time data-aggregation skills, specifically React component state management, handling streaming updates, choosing appropriate in-memory data structures (e.g., Map), and timestamp parsing/comparison for per-category frequency and last-update tracking.
You are building a small React feature that displays real-time statistics from a log stream.
Each incoming event has:
category
: string (e.g.,
"auth"
,
"payments"
)
timestamp
: ISO-8601 string or epoch milliseconds (time the event occurred)
Example event:
{ "category": "auth", "timestamp": "2025-12-15T10:15:30Z" }
Implement a React component (or a small set of components) that:
onEvent(event)
or via a mocked interval).
category
.
timestamp
seen for that category
Map
(or justify an alternative) to store per-category stats.