Skip to main content

`<User />`

Cloud has the newest features. Some may not be in a release yet; the newest release is Identity & Access Management 7.3.0.

The User component is a declarative way to access the authenticated user object from the Choreo Identity & Access Management authentication context. It uses render props to expose the user data, making it easy to display user information or conditionally render UI based on authentication state.

Usage​

Use the User component to access and display user information in your React application.

Basic Usage​

Display the user's name and email:

src/App.jsx
import { User } from '@thunderid/react'

function App() {
return (
<User fallback={<p>Please sign in</p>}>
{(user) => (
<div>
<h1>Welcome, {user?.displayName}!</h1>
<p>Email: {user?.email}</p>
</div>
)}
</User>
)
}

export default App
note

The user object will be null if no user is signed in. Use the fallback prop to show alternative content.

Props​

PropTypeRequiredDescription
children(user: User | null) => ReactNode✅Render prop function that receives the user object
fallbackReactNode❌Content to render when no user is signed in

Was this page helpful?