Skip to content

Commit e9db767

Browse files
committed
fix(forms): export useFormControl2
1 parent f96bc1b commit e9db767

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

demo/Form2Examples.jsx

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable no-console */
22
import React from 'react';
3-
import { Form2, FormInput2, FormSelect2, FormSwitch2 } from '../dist/main';
3+
import { Form2, FormInput2, FormSelect2, FormSwitch2, useFormControl2 } from '../dist/main';
44

55
export function Form2Examples() {
66
return (
@@ -31,8 +31,18 @@ export function Form2Examples() {
3131
<label htmlFor="">AttrD</label>
3232
<FormSwitch2 name="attrD" id="attrD" />
3333
</div>
34+
<div className="form-group">
35+
<label htmlFor="">Version</label>
36+
<FormVersion />
37+
</div>
3438
<button className="btn btn-success">Submit</button>
3539
</Form2>
3640
</div>
3741
);
3842
}
43+
44+
function FormVersion() {
45+
const { getValue } = useFormControl2('__v');
46+
47+
return <div>{getValue() || ''}</div>;
48+
}

src/forms2/index.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ export * from './Form';
22
export * from './FormInput';
33
export * from './FormSelect';
44
export * from './FormSwitch';
5+
export * from './helpers/useFormControl';

0 commit comments

Comments
 (0)