import { SubmitButton, Form, FormInput, FormRow, FormButtons, TextField } from 'react-basics'; import { useMutation } from '@tanstack/react-query'; import { useRef } from 'react'; import useApi from 'hooks/useApi'; export default function TeamEditForm({ teamId, data, onSave }) { const { post } = useApi(); const { mutate, error } = useMutation(data => post(`/teams/${teamId}`, data)); const ref = useRef(null); const handleSubmit = async data => { mutate(data, { onSuccess: async () => { ref.current.reset(data); onSave(data); }, }); }; return (
Save
); }