I am creating a registration form in React Native. Currently, I am using useState()
hook for each field:
const [firstName, setFirstName] = useState(""); const [lastName, setLastName] = useState(""); const [phoneNumber, setPhoneNumber] = useState(""); const [userEmail, setUserEmail] = useState(""); const [userPassword, setUserPassword] = useState("");
This way does the job, but is it the correct one? Is it possible to manage it by using a single useState()
instead of having state one for each field? Should I use package react-hook-form or another package?
Edit:
const [registerForm, setRegisterForm] = useState({ firstName: "", lastName: "", phoneNumber: "", userEmail: "", userPassword: "" });
This way would also work.