-
-
Notifications
You must be signed in to change notification settings - Fork 46.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Menu.Item] TypeError: Cannot read property 'indexOf' of undefined #7097
Comments
|
OK. For Ant Design Roadmap, will Menu and Sub Menu support wrapping custom component as new enhancement / feature ? |
For further information, you can trace #4853 |
|
@ddcat1115 How do I solve this? |
why is this closed? it's not solved @benjycui |
what's the workaround if i want to use Submenu in a custom component? |
While this isn't an ideal solution, a work-around is that you invoke the function in-between brackets. The example provided above is a bit vague (for example, why are props being passed into the function if they aren't needed/used); however, to be consistent with the above example, here are 3 ways to achieve the desired result: Declare a function inside the component:menuComponent.js
Declare a function outside of the component:menuComponent.js
Declare a function in a different file:menuComponent.js
separateMenuItem.js
Things to consider:
|
Version
2.12.3
Environment
OSX 10.12, Opera 46 / Chrome 59
Reproduction link
https://codepen.io/anon/pen/QMdwXP
Steps to reproduce
What is expected?
Expected no error occurs while using wrapper.
What is actually happening?
Errors occur while I create wrapper for Menu.Item
Duplicate Issue : #7092
The text was updated successfully, but these errors were encountered: