question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught TypeError: onItemHover is not a function

See original GitHub issue

Hi There, I’m running into a console error on a vertical menu where when I do a mouseover. Note that I have a horizontal menu on the same page (with a dropdown) that’s not throwing this error.

Here’s the console error: Uncaught TypeError: onItemHover is not a function at MenuItem._this.onMouseEnter (MenuItem.js:54) at HTMLUnknownElement.callCallback (react-dom.development.js:100) at Object.invokeGuardedCallbackDev (react-dom.development.js:138) at Object.invokeGuardedCallback (react-dom.development.js:187) at Object.invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:201) at executeDispatch (react-dom.development.js:466) at executeDispatchesInOrder (react-dom.development.js:488) at executeDispatchesAndRelease (react-dom.development.js:586) at executeDispatchesAndReleaseTopLevel (react-dom.development.js:597) at Array.forEach (<anonymous>) at forEachAccumulated (react-dom.development.js:565) at runEventsInBatch (react-dom.development.js:728) at runExtractedEventsInBatch (react-dom.development.js:737) at handleTopLevel (react-dom.development.js:4201) at batchedUpdates (react-dom.development.js:12537) at batchedUpdates (react-dom.development.js:1939) at dispatchEvent (react-dom.development.js:4282)

Here’s the code:

<Menu > <MenuItem key={props.props.groupId+'-create-event'}><Link to={props.props.rootUri + "/create-event"}>Create Event</Link></MenuItem> </Menu>

All the props variables are valid.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:3
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

25reactions
dnlfrstcommented, Aug 14, 2018

I also came accross this issue yesterday. To get things moving, follow the steps below to reproduce the error.

Steps to reproduce (assuming Chrome to be used):

  1. Open this codepen.
  2. Open DevTools and switch to the Console tab.
  3. Hover over the Menu.Item (i. e. the word Foo) with your mouse.
  4. Observe the error message in the Console tab: Uncaught TypeError: onItemHover is not a function

The issue can either be fixed by handing down the props Menu propagates to Menu.Item, i. e. changing:

  • const CustomMenuItem = () => { to const CustomMenuItem = props => { and
  • <Menu.Item key="1"> to <Menu.Item {...props} key="1">

or removing the functional component completely, resulting in:

<Menu
   style={{ width: 256 }}
   defaultSelectedKeys={['1']}
>
   <Menu.Item key="1">
      Foo
   </Menu.Item>
</Menu>

IIRC such changes were not necessary in the past. Is this an issue or am I doing something wrong?

16reactions
cesarve77commented, Jul 2, 2019

Here a solution: you need to propagate the props https://codepen.io/anon/pen/jjzogG

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fail creating a SubMenu in a component with antd
Uncaught TypeError: onItemHover is not a function at onTitleMouseEnter (SubMenu.js:454). For this one I have absolutely no idea what to do.
Read more >
Menu 出现 onItemHover is not a function错误 #19463
I have searched the issues of this repository and believe that this is not a duplicate.
Read more >
'X' is not a function TypeError in React [Solved] | bobbyhadz
The React.js Uncaught TypeError: X is not a function occurs when we try to call a value that is not a function as...
Read more >
react项目使用antd的menu组件报错
Item展示到页面, 使用递归遍历路由之后点击一级菜单后展示出的二级菜单都会报错: Uncaught TypeError: onItemHover is not a function
Read more >
react-component - Bountysource
React does not recognize the eventKey prop on a DOM element. ... Uncaught TypeError: onItemHover is not a function at MenuItem._this.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found