#hmmm for some reason I get the following
1 messages · Page 1 of 1 (latest)
Hi @atomic quest. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
Sorry @atomic quest, I seem to be having a bit of trouble. Don't worry though, I've pinged my supprt and they will try to fix me up! :technologist:
Perhaps try again in 15mins?
@wise timber Why do I get this error, although the respective hooks are called in the begining of the component?
#0 37.81 ./app/[lang]/components/Stream/ChatLine.tsx
#0 37.81 103:20 Error: React Hook "usePathname" is called conditionally. React Hooks must be called in the exact same order in every component render. react-hooks/rules-of-hooks
#0 37.81 104:24 Error: React Hook "useSearchParams" is called conditionally. React Hooks must be called in the exact same order in every component render. react-hooks/rules-of-hooks
#0 37.81 105:29 Error: React Hook "useSession" is called conditionally. React Hooks must be called in the exact same order in every component render. react-hooks/rules-of-hooks
#0 37.81 107:45 Error: React Hook "useState" is called conditionally. React Hooks must be called in the exact same order in every component render. react-hooks/rules-of-hooks
Let me check the knowledge base for you. One moment! :books:
Hmm, I don't know enough to give you a confident answer yet. However, I can provide you with some general guidance on React Hooks.
The error messages you're encountering are related to the Rules of Hooks (https://reactjs.org/docs/hooks-rules.html) in React. Hooks must be called at the top level of your component and not inside loops, conditions, or nested functions. This ensures that the order of Hooks remains consistent between renders.
To fix these errors, make sure you call usePathname, useSearchParams, useSession, and useState at the top level of your component, and not inside any conditional statements or loops.
For more information on React Hooks and their usage, you can refer to the React Hooks documentation (https://reactjs.org/docs/hooks-intro.html).
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@atomic quest kapa.ai is still learning and improving, please let us how it did by reacting below