title | isDefaultIndex | generated |
---|---|---|
UseFormControl |
false |
true |
import MemberInfo from '@site/src/components/MemberInfo'; import GenerationInfo from '@site/src/components/GenerationInfo'; import MemberDescription from '@site/src/components/MemberDescription';
Provides access to the current FormControl value and a method to update the value.
Example
import { useFormControl, ReactFormInputProps } from '@vendure/admin-ui/react';
import React from 'react';
export function ReactNumberInput({ readonly }: ReactFormInputProps) {
const { value, setFormValue } = useFormControl();
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setFormValue(val);
};
return (
<div>
<input readOnly={readonly} type="number" onChange={handleChange} value={value} />
</div>
);
}
function useFormControl(): void