Search…
<RedirectToSignUp />
Navigate immediately to the sign-up URL

Overview

Rendering a <RedirectToSignUp/> component will navigate to the sign up URL which has been configured in your application instance. You can find the configuration on the Paths page.
The behavior will be just like a server-side (3xx) redirect, and will override the current location in the history stack.

Usage

Make sure you've followed the installation guide for Clerk React before running the snippets below.
The example below shows a page which is normally accessible by authenticated users. All other visitors (unauthenticated requests) will get redirected to the sign up page.
The <SignedIn/> and <SignedOut/> components work together as a conditional, allowing the <RedirectToSignUp/> component to be rendered only for unauthenticated requests.
Clerk React
1
import {
2
ClerkProvider,
3
SignedIn,
4
SignedOut,
5
RedirectToSignUp
6
} from "@clerk/clerk-react";
7
8
function PrivatePage() {
9
return (
10
<ClerkProvider frontendApi="clerk.[your-domain].com">
11
<SignedIn>
12
Content that is displayed to signed in
13
users.
14
</SignedIn>
15
<SignedOut>
16
{/*
17
Non-authenticated visitors will be redirected
18
to the sign up page.
19
*/}
20
<RedirectToSignUp />
21
</SignedOut>
22
</div>
23
);
24
}
Copied!

Props

Name
Description
redirectUrl?
string
Full URL or path to navigate to after successful sign in or sign up. Use this instead of setting afterSignInUrl and afterSignUpUrl to the same value. To return to the same URL, set to window.location.href
afterSignInUrl?
string
The full URL or path to navigate to after a successful sign in. Defaults to the Sign-in URL on the Paths page of your Dashboard.
afterSignUpUrl?
string
The full URL or path to navigate to after a successful sign up. Defaults to the Sign-up URL on the Paths page of your Dashboard.
Copy link