Skip to main content

Practice ยท 2 of 3

Action Router

Write handleClick(event, root, actions): resolve the actionable element as in resolveAction, read el.dataset.action, and call actions[action](el) when the handler exists. RETURN the action name that was dispatched, null when nothing matched, and "missing" when the element matched but actions has no handler for it. actions must never be mutated.

Difficulty: intermediate

Back to lesson: Practice: Event Delegation โ€” Practice