Skip to content

Commit

Permalink
docs: avoid legacy Svelte syntax (#13166)
Browse files Browse the repository at this point in the history
* avoid invalid svelte syntax

* type submit event correctly

---------

Co-authored-by: Harry Allen <[email protected]>
  • Loading branch information
HarryAllen1 and HarryAllen1 authored Dec 16, 2024
1 parent 9613843 commit 88ab109
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions documentation/docs/20-core-concepts/30-form-actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,9 @@ We can also implement progressive enhancement ourselves, without `use:enhance`,
/** @type {{ form: import('./$types').ActionData }} */
let { form } = $props();

/** @param {{ currentTarget: EventTarget & HTMLFormElement}} event */
/** @param {SubmitEvent & { currentTarget: EventTarget & HTMLFormElement}} event */
async function handleSubmit(event) {
event.preventDefault();
const data = new FormData(event.currentTarget);

const response = await fetch(event.currentTarget.action, {
Expand All @@ -451,7 +452,7 @@ We can also implement progressive enhancement ourselves, without `use:enhance`,
}
</script>

<form method="POST" onsubmit|preventDefault={handleSubmit}>
<form method="POST" onsubmit={handleSubmit}>
<!-- content -->
</form>
```
Expand Down

0 comments on commit 88ab109

Please sign in to comment.