onClick
onClick is an event-handler property, attribute, or callback association that specifies behavior in response to a user-interface click event.
React Quickly, Second Edition
onClick is a React event-handler property that specifies a callback for click events on an element or component.
- How it is used
- Handles user clicks in interactive React interfaces by assigning callbacks to JSX elements or components.
- How deep it goes
- Defines JSX assignment, event objects, propagation, and default-action control, while deferring most implementation details.
- Examples
- Uses a button that opens an expandable menu and contrasts React handlers with window and menu pointer-down listeners.
- What you can do after
- Apply it via React to attach click callbacks, update component state, and control event behavior with the event object.
Pro ASP.NET Core 7, Tenth Edition
The @onclick attribute is a Blazor event-handling directive attribute that binds a user-interface click event to a .NET method or expression.
- How it is used
- Uses button clicks in Blazor administration components to trigger application actions.
- How deep it goes
- Explains method and callback invocation through component examples, while deferring deeper Blazor treatment.
- Examples
- Shows order selection, data refresh, and product deletion in SportsStore administration components.
- What you can do after
- Apply Blazor’s @onclick directive to invoke component methods for order selection, refresh, or product deletion.
Read how Pro ASP.NET Core 7, Tenth Edition explains onClick →
Related concepts
- handlerconfigures · A handler is a callable or software component that processes an event, request, message, or other input and performs associated processing.
- buttonconfigures · A button is an interactive user-interface control that can be activated to initiate an action or select an option.
- Razor componentused by · A Razor component is a reusable user-interface unit defined with Razor markup and .NET code that can render content and handle interactions.
- addEventListenercontrasts with · addEventListener is a web API method that registers a callback to run when a specified event occurs on an event target.
- JavaScriptuses · JavaScript is a high-level, dynamically typed, multi-paradigm programming language standardized as ECMAScript and used for web and general-purpose programming.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

