Svelte · Senior · Question 40 of 75
How does use:enhance customization work?
<form method="POST" use:enhance={({ formData, cancel }) => {
submitting = true;
return async ({ result, update }) => {
submitting = false;
await update();
};
}}>- ✓Correct answer: The outer function runs before submit (can cancel or modify data); the returned callback handles the result and
update()applies the default behaviour - 2It only accepts a URL
- 3Customization requires a separate library
Explanation
Skipping update() lets you handle results fully yourself, for example to avoid resetting the form.