- Common components (e.g. <div>)·续4
- Parameters
- CompositionEvent handler function
- DragEvent handler function
- FocusEvent handler function
- Event handler function
- InputEvent handler function
- KeyboardEvent handler function
- MouseEvent handler function
- PointerEvent handler function
- TouchEvent handler function
- TransitionEvent handler function
- UIEvent handler function
- WheelEvent handler function
Common components (e.g. <div>)·续4
<input
onCopy={e => console.log('onCopy')}
onCut={e => console.log('onCut')}
onPaste={e => console.log('onPaste')}
/>
Parameters
-
e: A React event object with these extraClipboardEventproperties:
CompositionEvent handler function
An event handler type for the input method editor (IME) events.
<input
onCompositionStart={e => console.log('onCompositionStart')}
onCompositionUpdate={e => console.log('onCompositionUpdate')}
onCompositionEnd={e => console.log('onCompositionEnd')}
/>
Parameters
e: A React event object with these extraCompositionEventproperties:data
DragEvent handler function
An event handler type for the HTML Drag and Drop API events.
<>
<div
draggable={true}
onDragStart={e => console.log('onDragStart')}
onDragEnd={e => console.log('onDragEnd')}
>
Drag source
</div>
<div
onDragEnter={e => console.log('onDragEnter')}
onDragLeave={e => console.log('onDragLeave')}
onDragOver={e => { e.preventDefault(); console.log('onDragOver'); }}
onDrop={e => console.log('onDrop')}
>
Drop target
</div>
</>
Parameters
e: A React event object with these extraDragEventproperties:dataTransfer
It also includes the inherited MouseEvent properties:
altKeybuttonbuttonsctrlKeyclientXclientYgetModifierState(key)metaKeymovementXmovementYpageXpageYrelatedTargetscreenXscreenYshiftKey
It also includes the inherited UIEvent properties:
FocusEvent handler function
An event handler type for the focus events.
<input
onFocus={e => console.log('onFocus')}
onBlur={e => console.log('onBlur')}
/>
Parameters
e: A React event object with these extraFocusEventproperties:relatedTarget
It also includes the inherited UIEvent properties:
Event handler function
An event handler type for generic events.
Parameters
e: A React event object with no additional properties.
InputEvent handler function
An event handler type for the onBeforeInput event.
<input onBeforeInput={e => console.log('onBeforeInput')} />
Parameters
e: A React event object with these extraInputEventproperties:data
KeyboardEvent handler function
An event handler type for keyboard events.
<input
onKeyDown={e => console.log('onKeyDown')}
onKeyUp={e => console.log('onKeyUp')}
/>
Parameters
e: A React event object with these extraKeyboardEventproperties:altKeycharCodecodectrlKeygetModifierState(key)keykeyCodelocalemetaKeylocationrepeatshiftKeywhich
It also includes the inherited UIEvent properties:
MouseEvent handler function
An event handler type for mouse events.
<div
onClick={e => console.log('onClick')}
onMouseEnter={e => console.log('onMouseEnter')}
onMouseOver={e => console.log('onMouseOver')}
onMouseDown={e => console.log('onMouseDown')}
onMouseUp={e => console.log('onMouseUp')}
onMouseLeave={e => console.log('onMouseLeave')}
/>
Parameters
e: A React event object with these extraMouseEventproperties:altKeybuttonbuttonsctrlKeyclientXclientYgetModifierState(key)metaKeymovementXmovementYpageXpageYrelatedTargetscreenXscreenYshiftKey
It also includes the inherited UIEvent properties:
PointerEvent handler function
An event handler type for pointer events.
<div
onPointerEnter={e => console.log('onPointerEnter')}
onPointerMove={e => console.log('onPointerMove')}
onPointerDown={e => console.log('onPointerDown')}
onPointerUp={e => console.log('onPointerUp')}
onPointerLeave={e => console.log('onPointerLeave')}
/>
Parameters
e: A React event object with these extraPointerEventproperties:heightisPrimarypointerIdpointerTypepressuretangentialPressuretiltXtiltYtwistwidth
It also includes the inherited MouseEvent properties:
altKeybuttonbuttonsctrlKeyclientXclientYgetModifierState(key)metaKeymovementXmovementYpageXpageYrelatedTargetscreenXscreenYshiftKey
It also includes the inherited UIEvent properties:
TouchEvent handler function
An event handler type for touch events.
<div
onTouchStart={e => console.log('onTouchStart')}
onTouchMove={e => console.log('onTouchMove')}
onTouchEnd={e => console.log('onTouchEnd')}
onTouchCancel={e => console.log('onTouchCancel')}
/>
Parameters
e: A React event object with these extraTouchEventproperties:altKeyctrlKeychangedTouchesgetModifierState(key)metaKeyshiftKeytouchestargetTouches
It also includes the inherited UIEvent properties:
TransitionEvent handler function
An event handler type for the CSS transition events.
<div
onTransitionEnd={e => console.log('onTransitionEnd')}
/>
Parameters
e: A React event object with these extraTransitionEventproperties:elapsedTimepropertyNamepseudoElement
UIEvent handler function
An event handler type for generic UI events.
<div
onScroll={e => console.log('onScroll')}
/>
Parameters
e: A React event object with these extraUIEventproperties:detailview
WheelEvent handler function
An event handler type for the onWheel event.
<div
onWheel={e => console.log('onWheel')}
/>
Parameters
e: A React event object with these extraWheelEventproperties:deltaModedeltaXdeltaYdeltaZ
It also includes the inherited MouseEvent properties:
altKeybuttonbuttonsctrlKeyclientXclientYgetModifierState(key)metaKeymovementXmovementYpageXpageYrelatedTargetscreenXscreenYshiftKey
It also includes the inherited UIEvent properties:
