Skip to content

Instantly share code, notes, and snippets.

@Abusayid693
Created February 11, 2022 15:57
Show Gist options
  • Save Abusayid693/dba2cc5260d78282c046ab5946cad887 to your computer and use it in GitHub Desktop.
Save Abusayid693/dba2cc5260d78282c046ab5946cad887 to your computer and use it in GitHub Desktop.
item list for dropdown
import { Menu } from "antd";
export const menu = (
handleDataFetching,
dropdownCategories,
selectedItem
) => {
return (
<Menu>
{dropdownCategories.map((item) => {
return (
/**
* Dont include the selected item in the list
*/
selectedItem.key != item.key && (
<Menu.Item
onClick={(e) => handleDataFetching(e.key,item.value)}
key={item.key}
>
{item.content}
</Menu.Item>
)
);
})}
</Menu>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment