title: Invalid Hook Call Warning
body: <p>I'm facing this error: &quot;Invalid Hook Call Warning&quot; and it says that there are three possibilities of why it is happening:</p>
  <ol>
  <li>You might have mismatching versions of React and the renderer (such as React DOM)</li>
  <li>You might be breaking the Rules of Hooks</li>
  <li>You might have more than one copy of React in the same app</li>
  </ol>
  <p>1 and 3 I'm quite sure they're not causing the problem, I installed react from the 'create react-app' boilerplate yesterday.</p>
  <p>This is the code that is causing the issue.</p>
  <pre><code>
  import { createContext, useState, useContext } from &quot;react&quot;
  import api from &quot;../services/api&quot;
  
  export const AuthContext = createContext({})
  
  const [user, setUser] = useState(null)
  
  async function Login() {
    const response = await api.post(&quot;/auth/local&quot;, {
      identifier: &quot;teste@teste.com&quot;,
      password: &quot;123123&quot;,
    })
  
    setUser(response.data.user)
    api.defaults.headers.Authorization = `Bearer ${response.data.token}`
  }
  
  export function AuthProvider({ children }) {
    return (
      &lt;AuthContext.Provider value={{ signed: Boolean(user), Login }}&gt;
        {children}
      &lt;/AuthContext.Provider&gt;
    )
  }
  
  export function useAuth() {
    const context = useContext(AuthContext)
  
    return context
  }
  </code></pre>
  <p>Could anyone help me?</p>