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

Function onAction

packages/dev/docs/pages/react-aria/home/ExampleApp.tsx:210–220  ·  view source on GitHub ↗
(item: (typeof items)[0], action: Key)

Source from the content-addressed store, hash-verified

208 let [dialog, setDialog] = useState<Key | null>(null);
209 let [actionItem, setActionItem] = useState<Plant | null>(null);
210 let onAction = (item: (typeof items)[0], action: Key) => {
211 switch (action) {
212 case 'favorite':
213 toggleFavorite(item.id, !item.isFavorite);
214 break;
215 default:
216 setDialog(action);
217 setActionItem(item);
218 break;
219 }
220 };
221
222 let onDialogClose = () => setDialog(null);
223

Callers 4

ExampleAppFunction · 0.70
PhotoItemFunction · 0.50
PhotoCardFunction · 0.50
IconListBoxFunction · 0.50

Calls 1

toggleFavoriteFunction · 0.85

Tested by

no test coverage detected