Calling Auth0 Login In Href
I'm trying to show a message if the user is not logged in. Please Login here (red color) to continue. In the render method, I need to check and see if the user is already logged in
Solution 1:
Try this:
<div> Please login <aonClick={this.login}href="#">here</a></div>
The reason is: An a
tag without the href
attribute is not rendered like a link by browsers. To mitigate that, we add it with some arbitrary value.
On your onClick
handler - login
in your case - you need to ensure that you prevent the default action - navigating to the relative url #
- from happening:
login = e => {
e.preventDefault();
// your login logic
}
Post a Comment for "Calling Auth0 Login In Href"