MCPcopy Index your code
hub / github.com/adobe/react-spectrum / performAction

Function performAction

packages/react-aria/src/menu/useMenuItem.ts:179–195  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

177 let onClose = props.onClose || data.onClose;
178 let router = useRouter();
179 let performAction = () => {
180 if (isTrigger) {
181 return;
182 }
183
184 if (item?.props?.onAction) {
185 item.props.onAction();
186 } else if (props.onAction) {
187 props.onAction(key);
188 }
189
190 if (data.onAction) {
191 // Must reassign to variable otherwise `this` binding gets messed up. Something to do with WeakMap.
192 let onAction = data.onAction;
193 onAction(key, item?.value);
194 }
195 };
196
197 let role = 'menuitem';
198 if (!isTrigger) {

Callers 1

onClickFunction · 0.70

Calls 1

onActionFunction · 0.50

Tested by

no test coverage detected