It's better to named form actions with the enhance helper instead of using fetch. Form actions can have any name and you can have any number of actions. Or better yet, use superforms if the app is quite complex. I wrote a large app without using fetch at all.
You don't need to turn every button into a form. You can use only one form with id=myform for example. Then set form=myform and formaction=?/delete for example on the button. Thus you can have one form and any number of form buttons.
i know about that... not a bad idea but i am used to doing it with fetch. i am also a big fan of superforms. but somehow the action of creating a form for every button didn't really click to me. but thanks!
@@nevillebrem Same principle. By using formaction. Although, I prefer to use dataType: json because my forms are quite complex. If you'd like, create svelte lab repl and if you get stuck, I can help you.
The output of the twMerge() function is always the same string, so it's VERY inefficient to run it, every time time the page reloads.
Post to API logout to delete a todo ? What wn interesting naming convention
Whoops 😅 DELETE
Just learnt alot from this.👌
If you'd just increase the font size and zoom a bit
Yo, will do that. Thanks for the advice
It's better to named form actions with the enhance helper instead of using fetch. Form actions can have any name and you can have any number of actions. Or better yet, use superforms if the app is quite complex. I wrote a large app without using fetch at all.
You don't need to turn every button into a form. You can use only one form with id=myform for example. Then set form=myform and formaction=?/delete for example on the button. Thus you can have one form and any number of form buttons.
i know about that... not a bad idea but i am used to doing it with fetch. i am also a big fan of superforms. but somehow the action of creating a form for every button didn't really click to me. but thanks!
@@nevillebrem "the action of creating a form for every button" You don't need to do that.
how would i pass down data with superforms?
@@nevillebrem Same principle. By using formaction. Although, I prefer to use dataType: json because my forms are quite complex. If you'd like, create svelte lab repl and if you get stuck, I can help you.
Very useful. Can you do a video on shallow routing?
eventually, yes!
There is a way to enhance images with url coming from API response? or only local images? Nice video btw
thanks for the feedback! i am not sure, sorry...
About the first one: it wont work if js is disabled in browser
a pitty but makes sense ig
Very nice brother, just as a tip, increase the font size and browser zoom
i'll do! thanks for the feedback
Very important most of us are watching from phone
Very good video. You should have however targeted svelte 5 probably (or provide both).
i also thought about that. i will make a dedicated svelte 5 video soon though
On your way to 1,000 subs! Have another!
thanks a lot!
Http delete not post
yeah true