Open History to see the last commit
1import { createFormHook, getFormHookHelpers } from '@tanstack/solid-form'
2import { TextField } from '../components/text-fields'
3β
4const { fieldComponent } = getFormHookHelpers()
5const AppTextField = fieldComponent.strict(TextField, 'field')
6β
7function SubscribeButton(props: { label: string }) {
8 const form = useFormContext()
9 return (
10 <form.Subscribe selector={(state) => state.isSubmitting}>
11 {(isSubmitting) => (
12 <button type="submit" disabled={isSubmitting()}>
13 {props.label}
14 </button>
15 )}
16 </form.Subscribe>
17 )
18}
19β
20const { appFormOptions, useAppForm, useFormContext } = createFormHook({
21 fieldComponents: {
22 TextField: AppTextField,
23 },
24 formComponents: {
25 SubscribeButton,
26 },
27})
28β
29export { appFormOptions, useAppForm }