ReactHookWrapper
Komponen ini merupakan alternatif lain untuk membuat form selain FormLowcode.
Base
ini contoh sederhana penggunaan ReactHookWrapper
Typescript
import { ReactHookWrapper, Button,Input} from 'alurkerja-ui'
import { FieldValues, useForm } from 'react-hook-form'
export const ReactHookWrapperPage = () => {
const { handleSubmit, control, setValue } = useForm()
const onSubmit = (data: FieldValues) => {
alert(JSON.stringify(data))}
return(
<ReactHookWrapper control={control}>
<Input
name="field_1"
aria-label="Field 1"
required
onChange={(e) => setValue(e.target.name, e.target.value)}
/>
<Input
name="field_2"
aria-label="Field 2"
required
onChange={(e) => setValue(e.target.name, e.target.value)}
/>
<Input
name="field_3"
aria-label="Field 3"
required
onChange={(e) => setValue(e.target.name, e.target.value)}
defaultValue={'sudah ad isinya'}
/>
/>
)
}