MCPcopy Create free account
hub / github.com/adobe/react-spectrum / Example

Function Example

packages/react-aria/test/utils/useEvent.test.tsx:23–27  ·  view source on GitHub ↗
({event, listener, options}: ExampleProps)

Source from the content-addressed store, hash-verified

21}
22
23function Example({event, listener, options}: ExampleProps) {
24 let ref = useRef<HTMLDivElement | null>(null);
25 useEvent(ref as RefObject<HTMLDivElement | null>, event, listener, options);
26 return <div ref={ref} data-testid="target" />;
27}
28
29describe('useEvent', () => {
30 it('subscribes on mount and unsubscribes on unmount', () => {

Callers

nothing calls this directly

Calls 1

useEventFunction · 0.90

Tested by

no test coverage detected