I had a react project then later I added MDB (material design for bootstrap). But I got when using MDB
Error: 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:
- You might have mismatching versions of React and the renderer (such as React DOM)
- You might be breaking the Rules of Hooks
- You might have more than one copy of React in the same app
Then I ran npm ls react
and got
client@0.1.0 /home/path/to/project/client
├─┬ mdbreact@4.27.0
│ └── UNMET PEER DEPENDENCY react@16.14.0
└── UNMET PEER DEPENDENCY react@17.0.1
So it looks like I have 2 versions of react. Similar result when I run npm ls react-dom
How do i fix this problem?