react-numeric-input icon indicating copy to clipboard operation
react-numeric-input copied to clipboard

Error: Only a ReactOwner can have refs...

Open DmitriySpirit opened this issue 7 years ago • 2 comments

If I use jest.resetModules() before each test case there is such error when I try to mount with enzyme my react component that uses react-numeric-input: "Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's render method, or you have multiple copies of React loaded (details: https://fb.me/react-refs-must-have-owner)"

When I import mount function from enzyme error is occurred, but when I require it in test scope everything is ok.

DmitriySpirit avatar Nov 21 '17 12:11 DmitriySpirit

This error happens in react 16 as well as in 15.6.2

I wrapped react-numeric-input with other html tags and created own component based on it. Then I compiled this new component and put it to git. Next I created new "create-react-app" project that includes this component from git and then I got this error. On the other hand, other components that were created by me and compiled the same way do not cause this error

nettiopsu avatar Dec 08 '17 15:12 nettiopsu

This should be fixed in the latest version. Could you confirm?

vlad-ignatov avatar Jan 13 '18 15:01 vlad-ignatov