Register.js -------------- import { useState } from " react " ; import " ./Register.css " ; import { useForm } from " react-hook-form " ; import axios from " axios " ; import { useNavigate } from " react-router-dom " ; function Register () { //error state let [ error , setError ] = useState ( "" ); let [ selectedFile , setSelectedFile ] = useState ( null ) //navigate const navigate = useNavigate (); //use form hook let { register , handleSubmit , formState : { errors }, } = useForm (); //adding new user let addNewUser = ( newUser ) => { // console.log(newUser); //make HTTP POST req to save newUser to localAPI let fd =new FormData (); //append newUser to form data fd . append ( " user " , JSON . stringify ( newUser )) //append selected file to form data fd . append ( " photo " , selectedFile ) axios