Day 7 β the first of a few planned improvements to the site. A lot of you (rightly!) disliked the tutorial dropdown navigation, so we fixed it. You can even navigate the tutorial with JS disabled, if you're so inclined
π https://svelte.dev/tutorial
π https://svelte.dev/tutorial
Comments
bind:value={getValue, setValue}
...which lets you transform and validate data
π docs https://svelte.dev/docs/svelte/bind#Function-bindings
π demo https://svelte.dev/playground/1ddd82f573b94201b3c8fcab33bf0a46?version=5.9.0
Should "get" be used only for validation? Or is it ok to change its return value?
Should any mutation/coercion be done only in "set"?
This is for an `` but I assume it's similar for other elements.
get/set continues to chalk up wins
π demo https://svelte.dev/playground/8095884c1f5040ea846669b904083e25?version=5.10.0
π docs https://svelte.dev/docs/kit/hooks#Shared-hooks-init
To know if we are in SSR or CSR context π
π docs https://svelte.dev/docs/svelte/svelte-reactivity-window
π demo https://svelte.dev/playground/8ac86e10fdce485a99c29c95e0092df4?version=5.11.0
Yknow, the way svh and lvh should work. Except they don't in Firefox and many built-in browsers. Mayday!
(Context: https://github.com/mozilla-mobile/firefox-ios/issues/11574#issuecomment-2146095621)
@svelte.dev @rich-harris.dev
π docs https://svelte.dev/docs/kit/hooks#Universal-hooks-transport
π demo https://stackblitz.com/edit/sveltejs-kit-template-default-b5zbxomg?file=src%2Fhooks.js
π docs https://svelte.dev/docs/llms
π demo (a snake game made by Sonnet 3.5) https://svelte.dev/playground/0de3c1c1a31d47bdbb7c4aa3477a6b46
The same would be nice for `+page.js` and `+layout.ts` load functions.