How I Fixed “Invalid Hook Call” and “React Hook Called in Non-Component” Errors in React

Recently, while working on a React + Supabase project, I encountered a frustrating error: