Use the hook useChangePassword to change password for the user.

const { changePassword, isLoading, isSuccess, isError, error } =
  useChangePassword()

console.log({ isLoading, isSuccess, isError, error })

const handleFormSubmit = async (e) => {
  e.preventDefault()

  await changePassword('my-new-password')
}