react-hook-form

React Form Hook with Autocomplete Material UI

与世无争的帅哥 提交于 2020-07-22 05:50:19
问题 I have a countries array which contains id and name . Currently I am using a Material UI Autocomplete element and I have a react hook form. When I submit the form, I want to fetch the the country Id. Currently it is posting the country name. Is there a way to post the ids instead of the names without going and fetching the id from the name. <Autocomplete className="form-item" options={countries} getOptionLabel={option => option.name} renderInput={params => ( <TextField {...params} inputRef=

Is it possible to use react-datepicker with react hooks forms?

时光怂恿深爱的人放手 提交于 2020-06-15 04:26:08
问题 Is it possible to use react-datepicker with react hooks forms? I tried following sample: https://codesandbox.io/s/awesome-shape-j0747?fontsize=14&hidenavigation=1&theme=dark But with no luck. import React, { useState } from "react"; import "./styles.css"; import { useForm } from "react-hook-form"; import { Row, Col, Form, FormGroup, Label, Input, Button } from "reactstrap"; import DatePicker from "react-datepicker"; export default function App() { const { register, handleSubmit } = useForm();

How to add items in select dynamically in react?

橙三吉。 提交于 2020-03-05 00:22:45
问题 Could you please tell me How to add items in select dynamically in react ? I am getting response from server (name , label etc).For example I just mock my response and after two second I fetch that . In my example I have two select box or drop down .first dropdown have value “one” and “two”(which is given as options in json). In json there is one more option dependentField it mean the field is dependent on another field (value mentioned is dependent).In my example second field is dependent on

React Hook Form with AntD Styling

只愿长相守 提交于 2020-02-25 06:31:44
问题 I'm trying to figure out how to use react-hook-form with antd front end. I have made this form and it seems to be working (it's part 1 of a multipart form wizard) except that the error messages do not display. Can anyone see what I've done wrong in merging these two form systems? I'm not getting any errors, but I think I have asked for both form fields to be required but if I press submit without completing them the error messages are not displayed. import React from "react"; import useForm