React ContextMenu - Access the Clicked Item

To access the clicked item, handle the itemClick event. If the event handling function is not going to be changed during the lifetime of the UI component, assign it to the onItemClick property when you configure the UI component.

App.js
  • import React from 'react';
  • import 'devextreme/dist/css/dx.light.css';
  •  
  • import { ContextMenu } from 'devextreme-react/context-menu';
  •  
  • class App extends React.Component {
  • render() {
  • return (
  • <ContextMenu ...
  • onItemClick={this.itemClick}
  • />
  • );
  • }
  •  
  • itemClick = (e) => {
  • const { itemData, itemElement, itemIndex } = e;
  • // ...
  • }
  • }
  •  
  • export default App;
See Also