Skip to content

Errors on useSignOut #19

Answered by tmm
cdedreuille asked this question in Q&A
Jun 9, 2021 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

You have 2 times error. ESLint is throwing an error as it doesn't know which is being used in the render.

I'm surprised that eslint isn't able to identify the correct error. Couple options available.

Rename error when destructuring:

const [{ error: signOutError, fetching }, signOut] = useSignOut()

async function onClickSignOut() {
  const { error: someOtherError } = await signOut()
}

if (signOutError) return <div>Error signing out</div>

Don't destructure error:

const [signOutResult, signOut] = useSignOut()

async function onClickSignOut() {
  const result = await signOut()
}

if (signOutResult.error) return <div>Error signing out</div>

Why having fetching if nothing is actually being…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@cdedreuille
Comment options

Answer selected by tmm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants