You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/fern/docs/pages/getting-started/users.mdx
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ In [the last guide](./setup.mdx), we created `StackServerApp` and `StackProvider
8
8
9
9
We can use the `useStackApp()` hook to get a `StackClientApp` object. With it, we can retrieve the current user in Client Components:
10
10
11
-
```tsxfocus={5-7} title="Client user profile"
11
+
```tsx title="Client user profile"
12
12
"use client";
13
13
import { useStackApp } from"@stackframe/stack";
14
14
@@ -25,7 +25,7 @@ Because it's so common, `useUser()` is also exposed as a standalone hook. This m
25
25
26
26
On Server Components, you don't need `useStackApp()`. Instead, you can just import the `StackServerApp` that you created in the previous chapter:
27
27
28
-
```tsxfocus={4-5} title="Server user profile"
28
+
```tsx title="Server user profile"
29
29
import { stackServerApp } from"@/stack";
30
30
31
31
exportdefaultasyncfunction MyComponent() {
@@ -45,7 +45,7 @@ Call `useUser` (or `getUser`) with the `{ or: 'redirect' }` option to protect th
45
45
46
46
<Tabs>
47
47
<Tabtitle="Client Component">
48
-
```tsxfocus={5-6} title="Client-side protection"
48
+
```tsx title="Client-side protection"
49
49
"use client";
50
50
import { useUser } from"@stackframe/stack";
51
51
@@ -57,7 +57,7 @@ Call `useUser` (or `getUser`) with the `{ or: 'redirect' }` option to protect th
57
57
</Tab>
58
58
59
59
<Tabtitle="Server Component">
60
-
```tsxfocus={4-5} title="Server-side protection"
60
+
```tsx title="Server-side protection"
61
61
import { stackServerApp } from"@/stack";
62
62
63
63
exportdefaultasyncfunction Protected() {
@@ -76,7 +76,7 @@ You can sign out the user by redirecting them to `/handler/signout` or simply by
76
76
77
77
<Tabs>
78
78
<Tabtitle="user.signOut()">
79
-
```tsxfocus={5-6} title="Sign-out button"
79
+
```tsx title="Sign-out button"
80
80
"use client";
81
81
import { useUser } from"@stackframe/stack";
82
82
@@ -88,7 +88,7 @@ You can sign out the user by redirecting them to `/handler/signout` or simply by
88
88
</Tab>
89
89
90
90
<Tabtitle="Redirect">
91
-
```tsxfocus={4-4} title="Sign-out link"
91
+
```tsx title="Sign-out link"
92
92
import { stackServerApp } from"@/stack";
93
93
94
94
exportdefaultasyncfunction SignOutLink() {
@@ -176,7 +176,7 @@ To see more examples of how to use the `User` object, check out the [User API do
176
176
177
177
You can update the user's information by calling `user.update()` with the new data. The user data from the `userUser()` hook is automatically will also be updated automatically. Here is an example:
178
178
179
-
```tsx title="Update user display name" focus={6-8}
0 commit comments