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