mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
Reworded Stack Auth -> Hexclave in restricted-users.mdx; renamed stack-app.mdx (guides + sdk/objects) and use-stack-app.mdx -> hexclave-app / use-hexclave-app; updated docs.json slugs + cross-links and added redirects from old slugs. Kept migration.mdx + 'formerly known as Stack Auth' historical notes. docs build validation + typecheck + lint green.
33 lines
781 B
Plaintext
33 lines
781 B
Plaintext
---
|
|
title: "useUser"
|
|
description: "React hook to access the current authenticated user."
|
|
sidebarTitle: "useUser"
|
|
icon: "react"
|
|
mode: "wide"
|
|
---
|
|
|
|
This standalone React hook is an alias for `useHexclaveApp().useUser()`. It only exists for convenience; it does not have any additional functionality.
|
|
|
|
For more information, please refer to the [documentation for `hexclaveClientApp.useUser()`](/sdk/objects/hexclave-app#stackclientappuseuseroptions).
|
|
|
|
## Usage
|
|
|
|
```jsx
|
|
import { useUser } from "@hexclave/next";
|
|
|
|
function MyComponent() {
|
|
const user = useUser();
|
|
|
|
if (!user) {
|
|
return <div>Not signed in</div>;
|
|
}
|
|
|
|
return <div>Hello, {user.displayName}</div>;
|
|
}
|
|
```
|
|
|
|
## Related
|
|
|
|
- [StackApp object reference](/sdk/objects/hexclave-app)
|
|
- [User type reference](/sdk/types/user)
|