# Invalid Hook Call

**URL:** <https://community.auth0.com/t/invalid-hook-call/89738>\
**Category:** Get Help\
**Tags:** auth0\
**Created:** [August 31, 2022, 1:13am UTC](https://community.auth0.com/t/invalid-hook-call/89738 "2022-08-31T01:13:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![wiley](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/wiley/32/34122_2.png) [@wiley](https://community.auth0.com/u/wiley)\
**Post date:** [August 31, 2022, 1:13am UTC](https://community.auth0.com/t/invalid-hook-call/89738/1 "2022-08-31T01:13:05Z")

</div>

I need to call an Auth0 hook in an OnClick() event. To distill the problem I’ve created the standard ‘npx create-react-app’ and did the following:

**App.js** now looks like this (basically changing it to have one ‘Click Me’ button with an onClick()):

```auto
import './App.css';
import Clickme from './clickme';

function App() {
  return (
    <div className="App">
      <header className="App-header">
        <button
        onClick={Clickme}
        >
          Click Me
        </button>
      </header>
    </div>
  );
}

export default App;

```

And I added **clickme.js:**

```auto
import { useAuth0 } from "@auth0/auth0-react";

export default function Clickme() {
  const { user } = useAuth0();
  const { email } = user;
  console.log("Email: ", email);
}

```

(Note: I really need to do more than get the user’s email. This working example is reduced to artificial simplicity to clearly isolate my question.)

When I run this and click ‘Click Me’ I get:

> “Invalid hook call. Hooks can only be called inside of the body of a function component…”

Wait, isn’t the call to useAuth0() _IN_ a function component? Searching Google and this forum I’m not getting anywhere. Many thanx in advance!

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [August 31, 2022, 10:19pm UTC](https://community.auth0.com/t/invalid-hook-call/89738/3 "2022-08-31T22:19:23Z")

</div>

Hi @wiley,

Welcome to the Auth0 Community!

I understand that you encountered errors when using the `useAuth0` hook.

After looking into this further, I found that you need to call the user’s email with `user.email` property when using the `useAuth0` hook. See [here](https://auth0.com/docs/quickstart/spa/react/01-login#show-user-profile-information) for an example.

Then, for an on-click event, please see our documentation [here](https://auth0.com/docs/quickstart/spa/react/01-login#add-login-to-your-application).

Please let me know how this works for you.

Thank you.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [December 21, 2022, 4:05pm UTC](https://community.auth0.com/t/invalid-hook-call/89738/4 "2022-12-21T16:05:01Z")

</div>


