import { useContext } from 'react'; import { FieldNameContext } from './FieldNameContext'; /** Hidden `
` that acts as an anchor to scroll to when a form error occurs. */ export default function FieldErrorScrollTarget() { const name = useContext(FieldNameContext); if (!name) { return null; } const divId = `${name.toLowerCase()}-error-scroll-target`; return ; }