Registry /
web-framework / better-auth-react-query
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
createAuthQueryClient
✓ import { createAuthQueryClient } from 'better-auth-react-query'
✗ const { createAuthQueryClient } = require('better-auth-react-query')
Package is ESM-only; named export.
default
✓ import betterAuthReactQuery from 'better-auth-react-query'
✗ import { default } from 'better-auth-react-query'
No default export; use named import instead.
createAuthQueryClient
✓ const { createAuthQueryClient } = await import('better-auth-react-query')
✗ const createAuthQueryClient = require('better-auth-react-query').createAuthQueryClient
In CJS environments, use dynamic import; require is not supported.
Demonstrates creating an auth query client and using both queries (getSession) and mutations (signIn.email) with TanStack Query hooks.
import { createAuthQueryClient } from 'better-auth-react-query'
import { createAuthClient } from 'better-auth/react'
import { useQuery, useMutation } from '@tanstack/react-query'
const authClient = createAuthClient()
const auth = createAuthQueryClient(authClient)
function Profile() {
const { data: session } = useQuery(auth.getSession.queryOptions())
return <div>Welcome, {session?.user.name}</div>
}
function SignInForm() {
const signIn = useMutation(auth.signIn.email.mutationOptions())
const handleSubmit = (e) => {
e.preventDefault()
const formData = new FormData(e.currentTarget)
signIn.mutate({
email: formData.get('email'),
password: formData.get('password'),
})
}
return (
<form onSubmit={handleSubmit}>
<input name="email" type="email" />
<input name="password" type="password" />
<button type="submit" disabled={signIn.isPending}>Sign In</button>
</form>
)
}
Errors
Common errors & fixes
Cannot find module 'better-auth-react-query' or its corresponding type declarations.
Package not installed or missing from package.json.
fixRun 'npm install better-auth-react-query' or add it to dependencies.
TypeError: createAuthQueryClient is not a function
Importing the wrong symbol (e.g., default export does not exist).
fixUse named import: import { createAuthQueryClient } from 'better-auth-react-query' Module not found: Can't resolve 'better-auth/react'
better-auth not installed or not configured for React.
fixInstall better-auth: 'npm install better-auth' and ensure React setup.
TypeError: auth.getSession.queryOptions is not a function
Auth client not properly wrapped; createAuthQueryClient not called.
fixCorrect usage: const auth = createAuthQueryClient(authClient); then use auth.getSession.queryOptions()
Audit
Dependencies
@tanstack/react-queryrequiredPeer dependency; provides useQuery, useMutation, and QueryClient required by the wrapper.
better-authrequiredPeer dependency; the source auth client is created via better-auth.