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

Function onChange

packages/react-aria/src/toggle/useToggle.ts:108–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106 useFormValidation(props, validationState, ref);
107
108 let onChange: ChangeEventHandler<HTMLInputElement> = e => {
109 // since we spread props on label, onChange will end up there as well as in here.
110 // so we have to stop propagation at the lowest level that we care about
111 e.stopPropagation();
112 state.setSelected(getEventTarget(e).checked);
113 };
114
115 let hasChildren = children != null;
116 let hasAriaLabel = ariaLabel != null || ariaLabelledby != null;

Callers

nothing calls this directly

Calls 2

getEventTargetFunction · 0.90
setSelectedMethod · 0.65

Tested by

no test coverage detected