Тёмный
No video :(

Introduction To Svelte Runes (Every Svelte Rune Explained) 

Cooper Codes
Подписаться 13 тыс.
Просмотров 3,9 тыс.
50% 1

Опубликовано:

 

6 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 32   
@Huntabyte
@Huntabyte 11 месяцев назад
Nicely explained!
@CooperCodes
@CooperCodes 11 месяцев назад
Beast! Hope you're doing well :)
@paulclarke4099
@paulclarke4099 11 месяцев назад
Best video I've watched covering this topic. Love your Svelte/SvelteKit coverage, thank you so much 😃👍
@marvinmonge3006
@marvinmonge3006 11 месяцев назад
+1 Great explanation! 🙌
@CooperCodes
@CooperCodes 11 месяцев назад
Thanks so much for the support Paul :) it is greatly appreciated, glad you found my videos helpful
@TheRealJuggaloJoel
@TheRealJuggaloJoel Месяц назад
this is so dope. Great delivery and description 5stars
@BRODZELi
@BRODZELi 10 месяцев назад
I'd love to see more video tutorials on Svelte, especially in anticipation of the upcoming Svelte 5 release. That would be truly awesome! 🚀👍
@jameskim7565
@jameskim7565 11 месяцев назад
Great video. And a quick note at 2:46, it seems like you have a typo at the bottom part with the tag, having "doubled" instead of "double"
@jingle1161
@jingle1161 11 месяцев назад
So basically $derived is a calculation and $effect is a watcher? Btw, that is golden. First example on RU-vid that clearly shows the concept of runes. I wasn't very excited with the syntax I saw till now. And that $props thing is fascinating. That's gonna ease a lot of parent/child communication
@CooperCodes
@CooperCodes 11 месяцев назад
The way I understand it is that $derived helps us keep values up to date in a simple way. If we have const testValue = $derived( variable1 + variable2 + variable3); Then if any of the variables inside of $derived change, testValue will get recalculated. I believe (I could be wrong) that in the old versions of Svelte, if you just said "testValue = variable1 + variable2 + variable3" the client would not update to the up to date value in certain cases. So the reason for the different syntax is to ensure the value will always be up to date. $effect can be understood as a way to introduce functionality 1. On initial component load and 2. When variables within the $effect change. It differs from $derived because within the effect we can create any functionality we want (whereas $derived is just a recalculation), although my was simple, you can create any functionality specific to the effect which is really interesting. Hopefully this helps! I'm also just learning the new syntax along you all but have done enough working around to create an intro video on it, glad the video was helpful for you :)
@gadgetboyplaysmc
@gadgetboyplaysmc 10 месяцев назад
$derived is very similar to useMemo in React. I primarily use it for derived states. A more real-world example would be if you want a Select Option to change based on the currently selected state (like filtering them) let selectedColor = $state("red") const colorOptions = ["red", "green", "yellow"] const allFoodOptions= [{ color: "red", value: "apple" }, { color: "red", value: "tomato" }, { color: "green", value: "spinach" }, { color: "yellow", value: "banana" }] let foodOptions = $derived( allOptions.filter((option) => option.color === selectedColor ) ) ---
@nickstaresinic4031
@nickstaresinic4031 11 месяцев назад
Good, concise explanation, Coop...I mean *Cooper*.
@riigel
@riigel 11 месяцев назад
thanks 👍👍 this is so clear!
@CooperCodes
@CooperCodes 11 месяцев назад
You're welcome! Thanks for your support and commenting so fast :)
@paulthomas1052
@paulthomas1052 11 месяцев назад
Hi, thanks for the update.
@CooperCodes
@CooperCodes 11 месяцев назад
You are very much welcome, thank you for watching !
@jengstrm2
@jengstrm2 11 месяцев назад
I wonder how it looks to subscribe and unsubscribe to observables using effects
@lian1238
@lian1238 11 месяцев назад
Isn’t that just writable stores?
@brandonlu2237
@brandonlu2237 11 месяцев назад
when did we just devolve into sorcery 😂😂
@CooperCodes
@CooperCodes 11 месяцев назад
🧙✨ 💀
@dot_method
@dot_method 11 месяцев назад
That looks like vue but with extra steps 😅
@jhonyortiz5
@jhonyortiz5 11 месяцев назад
Can you give one or more examples? I'm curious about Vue and I keep seeing people comparing svelte 5 to Vue.
@dot_method
@dot_method 11 месяцев назад
@@jhonyortiz5 svelte --> vue $props --> defineProps $state --> ref $derived --> computed $effect --> watch
@dot_method
@dot_method 11 месяцев назад
And just to be clear, I like both svelte and vue alike, but it's a bit funny to see the convergence
@nuttbaked
@nuttbaked 10 месяцев назад
trying so hard to not look biased towards vue lol
@moussaibrahem9
@moussaibrahem9 11 месяцев назад
Simply it is hooks in react
@nickstaresinic4031
@nickstaresinic4031 11 месяцев назад
Without having played with it yet, that's what the syntax looks like.
@DEVDerr
@DEVDerr 11 месяцев назад
Not exactly. It's just made way better. You will not run into many pitfalls like in the React (f.e. all of the weird implicit useEffect() behaviors) But it will actually make codebase simpler, because now Svelte scripts will be JS in 100%. They will not change the semantics like with export let (which defined a prop instead of exporting a module). So f.e. you can write some logic, put into into Svelte file and it will behave exactly the same way like in normal JS. And you can also do it the other way around - you can now also use Svelte features outside of Svelte files f.e. use $state() and $derived() in some external JS files
@nickstaresinic4031
@nickstaresinic4031 11 месяцев назад
@@DEVDerr "...use $state() and $derived() in some external JS files" That indeed would be very useful. When I've run into that problem, I've used lihautan's work-around(s), found on RU-vid under "How to use Svelte store in .js file?"
@DEVDerr
@DEVDerr 11 месяцев назад
@@nickstaresinic4031 It was not a workaround really. The only way to use Svete's reactivity outside of Svelte files was actually using a Svelte's built-in store. Which wasn't that big of a problem really, it was actually nice that you could update/retrieve data in some JS/TS files and I love that (especially while creating games). But now it will be even better, because $state and $derived behave more like primitives. You can compose them together and create reusable stateful logic (like with Hooks in React) but with all of the Svelte's performance and DX benefits
@amrita368
@amrita368 11 месяцев назад
How to upload image using nodejs mongoose and graphql ?? Plz upload a video
@iojourny
@iojourny 11 месяцев назад
So basically they realized Vue was right all along 😂
Далее
Svelte 5 Preview | Runes
12:40
Просмотров 77 тыс.
Прохожу маску ЭМОЦИИ🙀 #юмор
00:59
Svelte Runes: Awesome or Awful?
11:40
Просмотров 15 тыс.
I Tried Every Svelte UI Library
20:57
Просмотров 47 тыс.
Svelte 5: Introducing Runes... with Rich Harris
12:35
Svelte 5: What's New by Simon Holthausen
44:01
Просмотров 1 тыс.
Don't Sleep on Svelte 5
12:22
Просмотров 43 тыс.
Svelte 5 Is A Triumph
22:04
Просмотров 64 тыс.
Svelte UI Libraries Have Leveled Up
12:14
Просмотров 59 тыс.
Rich Harris - Annoying Things About Svelte
30:43
Просмотров 54 тыс.
Coding Was HARD Until I Learned These 5 Things...
8:34
Прохожу маску ЭМОЦИИ🙀 #юмор
00:59