minop1205 / react-dnd-treeview

A draggable / droppable React-based treeview component. You can use render props to create each node freely.
MIT License
530 stars 71 forks source link

Invalid hook call. Hooks can only be called inside of the body of a function component. #160

Closed Aagam41 closed 2 years ago

Aagam41 commented 2 years ago

Describe the bug Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:

  1. You might have mismatching versions of React and the renderer (such as React DOM)
  2. You might be breaking the Rules of Hooks
  3. You might have more than one copy of React in the same app See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.

To Reproduce Steps to reproduce the behavior:

  1. ReactJs 18.2.0, React Dom 18.2.0
  2. Produce the minimal setup of the treeview

Expected behavior Hooks should be called inside FUNCTIONAL COMPONENTS

Screenshots Screenshot from 2022-10-23 11-17-00 Issue is on line number 35, where useEffect is called inside useMemo. \ Screenshot from 2022-10-23 11-19-31

kenbostoen commented 8 months ago

How did you solve this?