Hooks (useState, useEffect, etc.) have two rules:
- Only call hooks at the top level — never inside conditions, loops, or nested functions.
- Only call hooks from React functions — components or other custom hooks.
jsx
() {
[user, setUser] = ();
(id) {
[x] = ();
}
}
