#button not working
1 messages · Page 1 of 1 (latest)
The issue seems to be with the way you're calling the handleLogin function in your onClick event. In your current code, you're not actually invoking the function. You're just referencing it.
To fix this, you should call the handleLogin function by adding parentheses () after it. Here's how you can do it:
<button
type="button"
aria-current="page"
className={"text-base font-medium text-white hover:text-gray-300"}
onClick={handleLogin}
>
{session ? "Logout" : "Login"}
</button>
In this corrected code, handleLogin will be called when the button is clicked. If handleLogin needs to be called with specific arguments, you can use an arrow function to pass those arguments:
<button
type="button"
aria-current="page"
className={"text-base font-medium text-white hover:text-gray-300"}
onClick={() => handleLogin(arg1, arg2)}
>
{session ? "Logout" : "Login"}
</button>
Replace arg1, arg2 with the actual arguments you want to pass to handleLogin.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@woeful cargo kapa.ai is still learning and improving, please let us know how it did by reacting below