<RedirectToUserProfile />

Navigate to the user profile URL.

Overview

Rendering a <RedirectToUserProfile/> component will navigate to the user profile URL which has been configured in your application instance. You can find the configuration in the Clerk Dashboard. Go to your application, select your instance, then go to Settings > URL & redirects.

This component will use the custom navigate function from the <ClerkProvider/> component if one is given - otherwise it will trigger a full page reload with the new URL location.

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 users) will get redirected to the sign in page.

The <SignedIn/> and <SignedOut/> components work together as a conditional, allowing the <RedirectToUserProfile /> component to be rendered only for authenticated users.

Clerk React
Clerk React
import {
ClerkProvider,
SignedOut,
SignedIn,
RedirectToSignIn,
RedirectToUserProfile,
} from "@clerk/clerk-react";
const frontendApi = process.env.REACT_APP_CLERK_FRONTEND_API;
function App() {
return (
<ClerkProvider frontendApi={frontendApi}>
{/* Signed in users will get redirected to
the user profile page */}
<SignedIn>
<RedirectToUserProfile />
</SignedIn>
<SignedOut>
<RedirectToSignIn />
</SignedOut>
</ClerkProvider>
);
}
export default App;

Props

This component accepts no props.