D
D
drunkseal2021-04-23 12:01:13
React
drunkseal, 2021-04-23 12:01:13

How to add Dropdown to one of the menu items?

I'm making a menu in React using [...].map.
How can I add Dropdown to one of the items?
I use Antd

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Valery, 2021-04-26
@vmakhnyuk

<Menu>
    {[...].map(item => {
         if (item === 'условие чтобы сделать из пункта Dropdown') {
                return (
                   <SubMenu>
                       <Menu.ItemGroup>
                            <Menu.Item>{item.name}</Menu.Item>
                       </Menu.ItemGroup>
                   </SubMenu>
                )
        }
        return (
            <Menu.Item>
                {item.name}
            </Menu.Item>
        )
    })}
</Menu>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question