Enhancing Forms
To reduce the friction inherent in forms on the web, SvelteKit provides us with a few options. We saw the first of those options earlier when we set use:enhance
on our login form. This one is great for keeping the page from redirecting as it can submit the form data in the background, which means our page doesn’t need to be reloaded. Another tool we’ve yet to see is what SvelteKit calls snapshots. In this section, we’ll look at both and how they can help improve the experience of your application:
enhance
- Snapshots
After completing this section, you’ll be capable of building forms for your users that will be intuitive and streamlined, leading to far greater chances of acceptance by users of your application.
enhance
By importing enhance
from $app/forms
, we can progressively enhance the flow of <form>
elements. This means that we can submit the data without requiring a page reload, which would normally be found...