ncaught Error: Invalid hook call

ncaught 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://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
Rules of Hooks – React
The library for web and native user interfaces
6 Replies
Neto
Neto10mo ago
you cant use hooks conditionaly
if(something === 1){
const ... = useState() // this is invalid
}
if(something === 1){
const ... = useState() // this is invalid
}
react query offers a enabled`parameter
Neto
Neto10mo ago
Disabling/Pausing Queries | TanStack Query Docs
If you ever want to disable a query from automatically running, you can use the enabled = false option. When enabled is false:
gave_one
gave_one10mo ago
so I cannot put GetFilteredUsers any function I have to treated as a typical react state
b_e_n_t_e_n
b_e_n_t_e_n10mo ago
useQuery is a hook
gave_one
gave_one10mo ago
@b_e_n_t_e_n (Rustular CEEO) sorry, but this isn't a different question how do u update t3 stack to have tailwind scss