Invalid hook call with App Router
Answered
Asiatic Lion posted this in #help-forum
Asiatic LionOP
I'm trying to set the context for an app but I keep getting an "Invalid hook call" error, I don't think I'm breaking the Rules of Hooks etc but I can't see where I'm going wrong, knowing me its blindingly obvious but can someone spot what I've mucked up?
Thanks in advance!
Thanks in advance!
Answered by not-milo.tsx
You can't use hooks outside of a component. Move the
useAuth call inside Login2 Replies
You can't use hooks outside of a component. Move the
useAuth call inside LoginAnswer
Asiatic LionOP
Thanks, I'd tried that previously but I'd had a bit of a brainfart and added the
useAuth call to both function and called login inside the fetch. Fixed the whole thing by moving the fetch to the login function in state.tsx and only haveing one useAuth call on the page