How to create signup button in react

Hey am fairly new to auth0 can someone tell me how to create a signup button that will take me directly to the signup page instead of on login am using the new universal login page

I searched through the new universal login page documentation and it says to add this parameter screen_hint=signup but how to add it am using react

Hello @mahadwarsahil, Welcome to the Auth0 Community!

As you mentioned is correct for the new universal login you can use the screen_hint=signup param

In your React App, you will need to add this param in the /authorize query which is generated for the initial login request. Have you tried entering this param in the rendering object?

Regards,
Sid

2 Likes

hey thank you so much for the response

import React from “react”;

import { useAuth0 } from “@auth0/auth0-react”;

const LoginButton = (props) => {

const { loginWithRedirect } = useAuth0();

return (

<button

  onClick={() => loginWithRedirect()}

  className="button is-primary"

>

  Login

</button>

);

};

export default LoginButton;

this is my component. where to add screen_hint=signup :frowning:

Hey @mahadwarsahil,

In the react application it will go in this code:

ReactDOM.render(
  <Auth0Provider
    domain={config.domain}
    clientId={config.clientId}
    audience={config.audience}
    redirectUri={window.location.origin}
    onRedirectCallback={onRedirectCallback}
    screen_hint="signup" // here

  >
    <App />
  </Auth0Provider>,
  document.getElementById("root")
);

This is in the index.js file.

Let me know if this helps!

1 Like

Thank you so much it worked like a charm!!! :slightly_smiling_face:

2 Likes

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.