← Files FingerprintARCHIVED FILE
skills/fingerprint-react/snippets/use-visitor-data.jsx
622 Bytes · Oct 4, 2026 · 12:25 UTC
// Identify at the moment of a sensitive action and send event_id to the backend.
import { useVisitorData } from '@fingerprint/react'
function LoginForm() {
// immediate: false → don't identify on mount; only when we call getData()
const { getData } = useVisitorData({ immediate: false })
async function handleSubmit(e) {
e.preventDefault()
const { event_id } = await getData()
await fetch('/api/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username, password, eventId: event_id }),
})
}
return /* ...form... */ null
}
SHA-256: 81fce334128b39b70e012a24b2016ec26a3029fba064c351a67e5f760a01bdf5