@base-ui-components/react
Version:
Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.
21 lines (20 loc) • 489 B
JavaScript
'use client';
import * as React from 'react';
import { NOOP } from "../utils/noop.js";
export const FormContext = /*#__PURE__*/React.createContext({
formRef: {
current: {
fields: new Map()
}
},
errors: {},
clearErrors: NOOP,
validationMode: 'onSubmit',
submitAttemptedRef: {
current: false
}
});
if (process.env.NODE_ENV !== "production") FormContext.displayName = "FormContext";
export function useFormContext() {
return React.useContext(FormContext);
}