cht8687 / react-hover

React hover --- make hover easy http://cht8687.github.io/react-hover/example/
MIT License
107 stars 25 forks source link

ReactHover.js:224 Uncaught TypeError: Cannot read property 'name' of undefined #49

Closed Datagrdn closed 4 years ago

Datagrdn commented 4 years ago

Not sure how to resolve this error:

ReactHover.js:224 Uncaught TypeError: Cannot read property 'name' of undefined

Here is my code:

`import React from 'react' import TriggerTest from './TriggerTest' import HoverTest from './HoverTest' import ReactHover from 'react-hover'

...

       <ReactHover options={optionsCursorTrueWithMargin}>
         <ReactHover.Trigger type='trigger'>
            <TriggerTest/>
         </ReactHover.Trigger>
         <ReactHover.Hover type='hover'>
            <HoverTest />
         </ReactHover.Hover>
       </ReactHover>

` Not sure what I'm missing. Any insight greatly appreciated!

cht8687 commented 4 years ago

Hi @Datagrdn , which version are you using?

In 2.0.0, you will need to import Hover and Trigger like this:

import ReactHover, { Trigger, Hover } from 'react-hover'
Datagrdn commented 4 years ago

Thank you, I can confirm that I am using 2.0.0

I changed the import line and am still receiving the error

cht8687 commented 4 years ago

Hi @Datagrdn , I made this example for you: https://codesandbox.io/s/charming-snyder-3hund?fontsize=14&hidenavigation=1&theme=dark

You can compare it with your implementation, it would be nice if you can reproduce it with a demo.

Datagrdn commented 4 years ago

Thank you so much for this! The example was very helpful. I hadn't properly configured my Hover component.