Base
Typescript
import { InputWithModal, Address} from 'alurkerja-ui'
import { useForm } from 'react-hook-form'
export const InputWithModalPage = () => {
const { setValue } = useForm()
const [alamat, setAlamat] = useState<FieldValues>()
const onSubmit = (data: FieldValues) => {
setAlamat(data)
alert(JSON.stringify(data))
}
return(
<InputWithModal title="Data Alamat" value={alamat?.address}>
{({ closeModal }) => (
<Address
setValue={setValue}
onSubmit={() => {
handleSubmit(onSubmit)()
closeModal()
}}
/>
)}
</InputWithModal>
)
}