Eliav2 / react-xarrows

Draw arrows (or lines) between components in React!
https://codesandbox.io/embed/github/Eliav2/react-xarrows/tree/master/examples?fontsize=14&hidenavigation=1&theme=dark
MIT License
584 stars 75 forks source link

v2 not as expected on react StrictMode? #82

Closed logankfuller closed 3 years ago

logankfuller commented 3 years ago

Describe the bug & Expected behavior After creating a new project and installing the newest version (2.0.0), the examples do not run, quoting an error: "Uncaught Error: 'Xwrapper' is required around element using 'useXarrow' hook! wrap your xarrows and connected elements with Xwrapper! "

To Reproduce All I did was create a new project, install the libraries (react-xarrows and react-draggable) and copy/paste the example code.

I did this in CodeSandbox as well: CodeSandbox

Screenshots Link to Error

Eliav2 commented 3 years ago

Your are right.. this is very stange; if you will copy and paste the example and replace the code of 'simple example' with this code at will work

logankfuller commented 3 years ago

Hey,

I've played around with the code a bit, but I'm not quite sure what you're asking. I've copied/pasted various parts and I still get the same error. Can you paste an example?

Eliav2 commented 3 years ago

see https://codesandbox.io/s/react-arrows-v2-works-qbpyv?file=/src/index.jsx seems to work perfectly fine here.

Eliav2 commented 3 years ago

whatt strange! StrictMode breaks v2 https://codesandbox.io/s/react-arrows-v2-strictmode-not-work-ko4ju?file=/src/index.jsx

i have no idea why, but StrictMode that create-react-app uses by default breaks react-xarrows v2. currently, to resolve just remove the wrapping StrictMode wrapper as a workaround until I will figure it out and would release a patch.

logankfuller commented 3 years ago

Yeah that seemed to be the fix. Thanks!

whatt strange! StrictMode breaks v2 https://codesandbox.io/s/react-arrows-v2-strictmode-not-work-ko4ju?file=/src/index.jsx

i have no idea why, but StrictMode that create-react-app uses by default breaks react-xarrows v2. currently, to resolve just remove the wrapping StrictMode wrapper as a workaround until I will figure it out and would release a patch.

Eliav2 commented 3 years ago

Open. This should be fixed

Eliav2 commented 3 years ago

related https://github.com/facebook/react/issues/21956