Skip to content

Commit 9575798

Browse files
committed
feat(forms): export useFormData hook to access formData from outside
1 parent 7dfeac3 commit 9575798

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/forms/helpers/useFormData.js

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { useContext } from 'react';
2+
import { FormContext } from './form-helpers';
3+
4+
export function useFormData() {
5+
const formState = useContext(FormContext);
6+
7+
return formState.getFormData();
8+
}

src/forms/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ export * from './FormSelect';
88
export * from './FormSwitch';
99
export * from './FormTextarea';
1010
export * from './helpers/useFormControl';
11+
export * from './helpers/useFormData';

0 commit comments

Comments
 (0)