minop1205 / react-dnd-treeview

A draggable / droppable React-based treeview component. You can use render props to create each node freely.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Aagam41 opened this issue · comments

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