<script lang="ts" generics="T">
  export let formData: T;
  export let onSubmit: (data: T) => void;

  function handleSubmit(event: SubmitEvent) {
    event.preventDefault();
    onSubmit(formData);
  }
</script>

<form on:submit|preventDefault={handleSubmit}>
  <slot />
  <button type="submit">Submit</button>
</form>
