skip to Main Content

Reactjs – How to submit form with react-query

I have following code const useCreateSupplier = (createSupplierCommand: CreateSupplierCommand) => { return useMutation({ mutationFn: () => axiosClient .post("/supplier", { createSupplierCommand }) .then((res: AxiosResponse) => res.data), onSuccess: async () => { await queryClient.invalidateQueries({ queryKey: [queries.get_suppliers], }); }, }); }; const CreateSupplierForm…

VIEW QUESTION

Reactjs – My handleLogin functon is not getting triggered after I press the login button?

const [showRegister, setShowRegister] = useState(false); const { register, handleSubmit, formState: { errors }, reset, } = useForm<FormSchemaType>({ resolver: zodResolver(formSchema), }); const handleFormSubmit: SubmitHandler<FormSchemaType> = (data) => { console.log("hello world"); if (showRegister === true) { handleRegister(data); console.log("registering data"); } else {…

VIEW QUESTION
Back To Top
Search