Hooking into event delegates
UI events are the cornerstone of user interaction on the web – signaling every click, scroll, or keyboard press and enabling you to craft an interactive application. An event delegate acts as a bridge between the browser and your code. Each user interaction triggers a designated handler that executes a predefined action. In this recipe, we will dive into the mechanics of event delegates, illustrating how they are detected and managed within a Blazor application.
Let’s create a page, where users can display and hide a list of tickets by clicking a button.
Getting ready
Before you implement a clickable button, do the following:
- Create a
Chapter03
/Recipe01
directory – this will be your working directory - Copy
Ticket
andTickets
sample files from theChapter03
/Data
directory in the GitHub repository
How to do it…
Follow these steps to implement a basic event delegate hook:
- Create a new routable...