Skip to content

二次封装时,无法获取到rc-menu中的context下发的值 #742

@crucioo

Description

@crucioo

我正在公司的组件库中封装Menu组件,是基于rc-menu进行的二次封装。现在有个逻辑是:在MenuItem被选中时,它所属的SubMenu的空心icon需要切换到选中态的实心icon,我发现在SubMenu中无法获取到它下属的MenuItem是否有被选中的。我尝试`import {PathUserContext} from 'rc-menu/lib/context/PathUserContext',但在使用React.useEffect(PathUserContext)无法获取到值。请教下我该如何能实现上述的切换逻辑?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions