Clerk: user?.fullName returns "undefined" even when logged in
Unanswered
Spectacled bear posted this in #help-forum
Spectacled bearOP
The following code logs "Username: Undefined" and I cannot understand why. There is no errors, and .fullName even comes up as a suggestion while writing user.
const {user} = useUser();
console.log("Username: " + user?.fullName);5 Replies
Tonkinese
show me the useUser() hook
@Tonkinese show me the useUser() hook
Spectacled bearOP
Thanks for wanting to help, but I just figured it out.
It is still showing "undefined" in console, but fullName shows on page when I return
It is still showing "undefined" in console, but fullName shows on page when I return
<div>Welcome {user?.fullName}!</div> 😄Tonkinese
This is most likely because the component is being rendered on the server and you are loking at the console.log on the client (or vice versa). Check both your terminal and client for the console.log
@Tonkinese This is most likely because the component is being rendered on the server and you are loking at the console.log on the client (or vice versa). Check both your terminal and client for the console.log
Spectacled bearOP
Yes, that was the issue 🙂 thanks
Tonkinese
Great!