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 →
Also covered in
- JavaScript in DepthIn early access (MEAP)
- Web Component Development with Modern Libraries and ToolingIn early access (MEAP)
- Building User-Friendly DSLs
What to know first
- buttonA button is an interactive user-interface control that a user can activate to initiate an action or select an option.
- Document Object ModelThe Document Object Model is a platform-independent programming interface that represents a document as a structured tree of nodes and provides ways to access and modify its content and structure.
- eventA software event is an occurrence, state change, or notification that can be detected, recorded, communicated, or handled by a system.
- HTMLHTML is the standard markup language for structuring content and elements in documents on the web.
Related concepts
- handlerconfigures · A handler is a routine or software component invoked to process an input, request, message, or event.
- buttonconfigures · A button is an interactive user-interface control that a user can activate to initiate an action or select an option.
- addEventListenercontrasts with · addEventListener is a method that registers a callback to be invoked when a specified event is dispatched to an event target.
- expressionuses · An expression is a syntactically formed combination of values, names, operators, or other terms that denotes or evaluates to a value or result.
- JavaScriptuses · JavaScript is a high-level, dynamically typed programming language standardized as ECMAScript and used for web and general-purpose programming.
Questions about onClick
What is onClick?
onClick is an event-handler property, attribute, or callback association that specifies behavior in response to a user-interface click event.
Which Manning books explain onClick?
React Quickly, Second Edition and Pro ASP.NET Core 7, Tenth Edition.
What should I know before learning onClick?
Manning books that teach onClick usually introduce button, Document Object Model, event and HTML first.
What is the difference between onClick and mouse-down event?
onClick is an event-handler property, attribute, or callback association that specifies behavior in response to a user-interface click event. A mouse-down event is a browser input event dispatched when a pointing-device button is pressed over a document or element.
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.

