Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback for “Getting Started” #564

Open
TeddyBo opened this issue Feb 7, 2024 · 1 comment · May be fixed by #566
Open

Feedback for “Getting Started” #564

TeddyBo opened this issue Feb 7, 2024 · 1 comment · May be fixed by #566

Comments

@TeddyBo
Copy link

TeddyBo commented Feb 7, 2024

Hi!

"useUser" hook has "id" as an input argument

function useUser (id) {
  const { data, error, isLoading } = useSWR(`/api/user/${id}`, fetcher)
 
  return {
    user: data,
    isLoading,
    isError: error
  }
}

but components "Avatar" and "Content" call it without arguments.

function Content () {
  const { user, isLoading } = useUser()
  if (isLoading) return <Spinner />
  return <h1>Welcome back, {user.name}</h1>
}

How does it work?

@koba04
Copy link
Collaborator

koba04 commented Feb 9, 2024

Thank you! This example should be useUser(id), I'll fix it.

@koba04 koba04 linked a pull request Feb 9, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants