In my react application with typescript I am using semantic-ui-react
for UI. this snabdobx shows the usage of Menu.Item
in javascript but I wan to use it in typescript and got confused.
<Menu.Item name="home" active={activeItem === 'home'}
onClick={this.handleItemClick}>
public handleItemClick = (
e: React.MouseEvent<HTMLAnchorElement>,
{name} // Here I ahve problem with typings to destruct the name
) => {
this.setState({ activeItem: name });
};
the types in the MenuItem.d.ts
are
export interface MenuItemProps extends StrictMenuItemProps {[key: string]: any}
export interface StrictMenuItemProps {
/*many other values */
/** Internal name of the MenuItem. */
name?: string
onClick?: (event: React.MouseEvent<HTMLAnchorElement>, data: MenuItemProps) => void
}
here {name}:{name:string}
does not work. and geting whole data the I can not setState with data.name