@@ -119,26 +119,26 @@ export function UserProvider({
119119```
120120
121121``` js filename="app/user-provider.js" switcher
122- ' use client' ;
122+ ' use client'
123123
124- import { createContext , useContext , ReactNode } from ' react' ;
124+ import { createContext , useContext , ReactNode } from ' react'
125125
126- const UserContext = createContext (null );
126+ const UserContext = createContext (null )
127127
128128export function useUser () {
129- let context = useContext (UserContext);
129+ let context = useContext (UserContext)
130130 if (context === null ) {
131- throw new Error (' useUser must be used within a UserProvider' );
131+ throw new Error (' useUser must be used within a UserProvider' )
132132 }
133- return context;
133+ return context
134134}
135135
136136export function UserProvider ({ children, userPromise }) {
137137 return (
138138 < UserContext .Provider value= {{ userPromise }}>
139139 {children}
140140 < / UserContext .Provider >
141- );
141+ )
142142}
143143```
144144
@@ -147,12 +147,12 @@ Finally, you can call the `useUser()` custom hook in any client component and un
147147``` tsx filename="app/profile.tsx" switcher
148148' use client'
149149
150- import { use } from ' react' ;
150+ import { use } from ' react'
151151import { useUser } from ' ./user-provider'
152152
153153export function Profile() {
154154 const { userPromise } = useUser ()
155- const user = use (userPromise );
155+ const user = use (userPromise )
156156
157157 return ' ...'
158158}
@@ -161,12 +161,12 @@ export function Profile() {
161161``` jsx filename="app/profile.js" switcher
162162' use client'
163163
164- import { use } from ' react' ;
164+ import { use } from ' react'
165165import { useUser } from ' ./user-provider'
166166
167167export function Profile () {
168168 const { userPromise } = useUser ()
169- const user = use (userPromise);
169+ const user = use (userPromise)
170170
171171 return ' ...'
172172}
0 commit comments