S
S
Sergey Zolotarev2021-07-02 08:20:00
React Native
Sergey Zolotarev, 2021-07-02 08:20:00

How to remove "Invalid hook call"?

Good morning!
I've been running into hooks for almost a whole week in practice, where I can't solve a problem with them while mastering the React technology family as a whole.
Since my application is being developed on the same RN, but using the Expo engine, I am almost finishing work on integrating multimedia capabilities into the project itself. Since when working with the library , the expo-avuse of hooks is required, trying to use them in the code, the compiler gave the following error:


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:
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://fb.me/react-invalid-hook-call  for tips about how to debug and fix this problem.


I know the essence of the error, but I used the options for correcting it, but nothing came of it.

Have you encountered this problem and how did you solve it correctly? How to apply hooks in React Native correctly, competently and without errors?

Examples of problematic code are available in the comments to this question!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question