rawatramani free asked 4 years ago


Expected behavior No error

Actual behavior 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:

Resources (screenshots, code snippets etc.) Since March of this year if i run NPM install it gives me this error on some pages that use MDB. My dependencies specify "mdbreact": "git+https://oauth2:**@git.mdbootstrap.com/mdb/react/re-pro.git", Does this problem exist with newer versions of MDBReact?


Piotr Glejzer staff commented 4 years ago

Can you more specify? Are you using components? Which one?



git.mdbootstrap.com/mdb/react/re-pro.git#4.22.0

I was able to solve this by using an earlier version of MDBReact. Newer version is breaking React classes.

Copy #4.22.0 to the end of the url in the package.json file. I suggest to always specify working version and only update when necessary.


ishan267 free answered 3 years ago


I am also facing similar problem, someone please help!!!


Piotr Glejzer staff commented 3 years ago

Try to remove <React.StrictMode/> from index.js. I recommend using the version react below 17 to use mdbreact because we didn't update these packages yet.


FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Closed

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: 4.27.0
  • Device: laptop
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: Yes
Tags