If you’re like me, you’ve been waiting for Remote Functions in SvelteKit for a long... long time... and they are awesome!

It will be extremely hard to ever go back. Even though they are still experimental, the time they save is priceless.

However, not every feature is ready. So, I am posting a list of them, and their workarounds, and their status.

1. Submit Type

This is the least important, but needed. You may want to declare your enhance function outside the component template.

In form actions, you use types like this:

import type { SubmitFunction } from '@sveltejs/kit';

const onSubmit: SubmitFunction<MyFormType> = async ({ formElement }) => {
...

<form method="POST" action="/" use:enhance={onSubmit}>

There isn’t a direct import for SubmitFunction, so…

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help