Code:
import React from 'react';
import { Menu, MenuButton, MenuItem } from 'rc-easyui';
class App extends React.Component {
TestMenu() {
function handleClick(val) {
console.log(val);
alert(val);
}
return (
<Menu onItemClick={handleClick.bind(this)}>
<MenuItem text="Add" value="add"></MenuItem>
<MenuItem text="Delete" value="delete"></MenuItem>
</Menu>
);
}
render() {
return (
<div>
<MenuButton text="Edit" plain iconCls="icon-edit" menu={this.TestMenu}></MenuButton>
</div>
);
}
}
export default App;
the button and menu renders fine, but I get no alert and no console log no matter where or what I click. I've tried every permutation of handleClick I can think of and either get understandable errors or no output. what's the right way to handle the item click and get the value?