Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
docs: Add clearValue for all input examples
Browse files Browse the repository at this point in the history
  • Loading branch information
jpedroschmitz committed Feb 19, 2021
1 parent 66d4214 commit 11ddd28
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
7 changes: 6 additions & 1 deletion docs/src/docs/guides/basic-form.mdx
Expand Up @@ -68,7 +68,12 @@ function Input({ name, ...rest }) {
registerField({
name: fieldName,
ref: inputRef.current,
path: 'value',
getValue: (ref) => {
return ref.value;
},
clearValue: (ref) => {
ref.value = "";
}
});
}, [fieldName, registerField]);

Expand Down
7 changes: 6 additions & 1 deletion docs/src/docs/recipes/simple-input.mdx
Expand Up @@ -21,7 +21,12 @@ export default function Input({ name, label, ...rest }) {
registerField({
name: fieldName,
ref: inputRef.current,
path: 'value',
getValue: (ref) => {
return ref.value;
},
clearValue: (ref) => {
ref.value = "";
}
});
}, [fieldName, registerField]);

Expand Down
7 changes: 6 additions & 1 deletion docs/src/docs/recipes/typescript.mdx
Expand Up @@ -68,8 +68,13 @@ const Input: React.FC<InputProps> = ({ name, label, ...rest }) => {
useEffect(() => {
registerField({
name: fieldName,
path: 'value',
ref: inputRef.current,
getValue: (ref) => {
return ref.value;
},
clearValue: (ref) => {
ref.value = "";
}
});
}, [fieldName, registerField]);

Expand Down

0 comments on commit 11ddd28

Please sign in to comment.