I\'d like to know if there is a best practice/correct way to setup a right-click menu for a React component.
I currently have this...
// nw is nw.gui
UPDATE:
Figured it out - here is what you can do
var addMenu;
componentWillMount: function() {
addMenu = new nw.Menu();
addMenu.append(new nw.MenuItem({
label: 'doSomething',
click: function() {
// doSomething
}
}));
},
contextMenu: function(e) {
e.preventDefault();
addMenu.popup(e.clientX, e.clientY);
},
render: function(){
return
}
In render you can pass a function to onContextMenu for when a right click occurs for this react component.