EventCallback Parameters

Learn to use event handlers in Blazor Webassembly.

We'll cover the following

An event callback is a method that we pass to another method to be called when a particular event occurs. For example, when the button on the Alert component is clicked, the @onclick event uses the OnOk parameter to determine the method that should be called. The method that the OnOK parameter references is defined in the parent component.

EventCallback parameters are used to share information from the child component to the parent component. They share information with their parent and notify their parent when something, such as a button click, has occurred. The parent component simply specifies the method to call when the event is triggered.

This is an example of an EventCallback parameter:

Get hands-on with 1200+ tech skills courses.