Practical Svelte 5 - Shopping Cart

  Рет қаралды 21,342

Huntabyte

Huntabyte

Күн бұрын

Пікірлер: 141
@readywhen
@readywhen 6 ай бұрын
I started web dev with svelte (after no code and vanilla). I loved it. Now I've been working with react for a while. Now I love svelte even more!
@andrewthomas3947
@andrewthomas3947 6 ай бұрын
Same journey. But doesn't tried react.
@codingwithjamal
@codingwithjamal 6 ай бұрын
i love svelte. it feels like normal html but with super powers
@Archbishop-Desmond-Tutu
@Archbishop-Desmond-Tutu 5 ай бұрын
Svelte is heavenly. React is a nightmare
@MadeInJack
@MadeInJack 5 ай бұрын
Can't wait for more Svelte 5 videos 😄 Maybe a full series with best practices to build, organize and manage large codebases?
@Huntabyte
@Huntabyte 5 ай бұрын
Noted!
@MikeHTMLAllTheThings
@MikeHTMLAllTheThings 6 ай бұрын
I actually love the idea of having the basic layout structure in place and then allowing others to try it however they like or follow along. Cool way to handle a tutorial.
@Huntabyte
@Huntabyte 6 ай бұрын
I'm glad to hear that! Was very curious how it would be received, so far, so good!
@MadeInJack
@MadeInJack 5 ай бұрын
+1
@smallSkrrtBigDreams
@smallSkrrtBigDreams 6 ай бұрын
This was so easy to understand, what a nice introduction to the new Svelte features! And having the examples be part of a larger context and not isolation makes it much easier to follow along. I've watched a lot of your videos, you are literally the reason I decided to learn Svelte, so thanks a bunch for all your work.
@Huntabyte
@Huntabyte 6 ай бұрын
Thanks for the kind words! Happy to hear that this was easy to understand!
@ridass.7137
@ridass.7137 6 ай бұрын
17:43 I think if there is a separate remove button, the decrease button should always be disabled and not remove the item when the current item quantity is 1. This would also prevent accidental removal of the item if, for example, you have added too many and then spam the decrease button to reduce the quantity, failing to stop at 1.
@Huntabyte
@Huntabyte 6 ай бұрын
Yeah I think I agree with you there from a UX perspective in retrospect!
@devbyveritech
@devbyveritech 5 ай бұрын
⁠​⁠@@Huntabyteremoving the item from cart when it’s less than 1 is very okay. Where I think the decrement button should be disabled is in the checkout page. But in the case of cart, it’s okay to remove the product
@jacobgoldenart
@jacobgoldenart Ай бұрын
Thanks! Great to see your thought process as you approach these various UI tasks. Great pace too, not too fast like other tutorials where I constantly have to pause the video. : )
@pasokoner
@pasokoner 6 ай бұрын
13:45 This technique alone makes the video worth watching
@roycrippen9617
@roycrippen9617 6 ай бұрын
Definitely. This week I started transitioning the codebase at work to svelte5 and I ran into this exact issue. It took me like 30 minutes to figure out how to fix it. I wish I had seen this video before I stumbled on that problem.
@bloozy85
@bloozy85 5 ай бұрын
I like svelte, but js frameworks time running out soon, it's obvious. Too much stuff going on and actually all of them seem to go into same direction and do the same stuff under the hood with different syntax and compilers. It's so nice to work with web components and JSDoc, and everything runs out of the box and natively. Just push your build on your webspace ... boom! No need for fancy serverless build & deploy services. What i actually really like tho, is a wordpress backend with a vanilla stack frontend. It so dead simple and works for most small and mid sized businesses.
@silvankuebler
@silvankuebler 5 ай бұрын
not really a technique but just a widely used convention also e.g. very loved in the python communtiy
@TheHermitHacker
@TheHermitHacker 6 ай бұрын
This is crazy good. This opened my eyes to Svelte 5's runes. Thank you. (Yes, make more videos, please)
@benjaminjameswaller
@benjaminjameswaller 5 ай бұрын
Love this tutorial on Svelte 5. Please do more to expand on these new concepts and in this shopping cart ui. Also I noticed you might want to cover the situation where when you added the same item more than once, the cart got a duplicate entry = it didn't just add one item with a count of two it added the same item on as separate entry.
@JoyofCodeDev
@JoyofCodeDev 6 ай бұрын
let's go 👏
@VeriousSmithIII
@VeriousSmithIII 5 ай бұрын
I'm just getting into building Javascript Apps because of Svelte. Been a WordPress dev most of my professional life. This video was helpful. Thanks for sharing. Looking forward to more!
@Huntabyte
@Huntabyte 5 ай бұрын
Glad it was helpful! More on the way!
@codewithguillaume
@codewithguillaume 6 ай бұрын
Ahhhhh feels good to see you again Hunter !
@francoisbouchet9907
@francoisbouchet9907 5 ай бұрын
Iam always struggling to understand documentations, so practical is the only way I manage to learn code..., this video is very helpful to onboard Svelte5 and runes subtleties... don't hesitate to publish some more! thanks! -- NB: I particularly like that you let the usual "errors / mistakes" happening on the go.... many youtubers edit them out, but they then lack an opportunity to explain what can go wrong and make us rethink our bad habits.
@Huntabyte
@Huntabyte 5 ай бұрын
I'm glad to hear that you found this useful! Will continue to publish more!
@chrismingay6005
@chrismingay6005 3 ай бұрын
I can't say the Svelte 5 features have really impressed me and I didn't get why I would need $effect. However your demo of it is fantastic, I'll have plenty of uses for it.
@supercurioTube
@supercurioTube 5 ай бұрын
That was awesome. I selected Svelte 5 for my next project, for which I haven't started to write the UI yet and seeing your concrete implementation was super informative.
@Huntabyte
@Huntabyte 5 ай бұрын
That's awesome to hear! I have some more videos queued up on additional UI and state patterns as well!
@alittlegreyhair1104
@alittlegreyhair1104 5 ай бұрын
A really useful video, thank you. In the first part I found all that tailwind markup confusing the picture where the SV-5 action was happening. 'Looking forward to learning more from you.
@Huntabyte
@Huntabyte 5 ай бұрын
You're welcome, and thanks for the feedback! I forgot to zoom in a bit on the code which caused more of the clutter to be in the way. In the next installment I've cleaned it up a bit and made the code a big bigger.
@alittlegreyhair1104
@alittlegreyhair1104 5 ай бұрын
@@Huntabyte Look forward to it :)
@emyralunthomas
@emyralunthomas 5 ай бұрын
Learned a ton about Svelte 5 from this video - thank you! Would love to see a follow up showing how to filter products by category
@Huntabyte
@Huntabyte 5 ай бұрын
Glad to hear that!
@aawnu
@aawnu 5 ай бұрын
Great video that perfectly introduces the new runes and workarounds. Learned a lot, thanks!
@Huntabyte
@Huntabyte 5 ай бұрын
I'm glad to hear that, thanks for the feedback!
@RicardoCamisa
@RicardoCamisa 6 ай бұрын
Svelte 5 is crazy good!
@Huntabyte
@Huntabyte 6 ай бұрын
Right?! I feel this weird excitement when writing it and it just feels so natural already!
@BhideSvelte
@BhideSvelte 6 ай бұрын
Two Ways To Mutate 1. only owner can mutate the array, obj in Main component 2. if childs want to mutate they should use bindable ..new concept.. or else just pass the function to child component ...every main logic stays in Main Component and you can mutate good one Thankss
@gageracer
@gageracer 6 ай бұрын
Not only I liked the video, this could be a great practive/quiz website "make this page reactive with svelte/solid/react". I love programming as if it's a puzzle.
@henoknigatu7121
@henoknigatu7121 6 ай бұрын
Hi , I really enjoy your SvelteKit tutorials! I was wondering if you could create a more comprehensive tutorial that covers most of SvelteKit's features in an integrated manner. Many tutorials out there are quite discrete and don't show how to use various features together. It would be incredibly helpful to see a full-fledged example with best practices and advice on how to structure a project. Thanks for considering this, and keep up the great work!
@Nukhtarov
@Nukhtarov 6 ай бұрын
I liked it. Would love to see more like this. Thank you Hunter
@Huntabyte
@Huntabyte 6 ай бұрын
More to come!
@adriablancafort
@adriablancafort 5 ай бұрын
Amazing video as always! I really love your content. I've noticed there isn't a good video explaining all the i18n options for sveltekit available and comparing them. It could be a good idea for a future video and I'm sure that your audience would be very interested to see it.
@Huntabyte
@Huntabyte 5 ай бұрын
Noted!
@AB-gx5zj
@AB-gx5zj 5 ай бұрын
Nice video (more on S5 please)!
@Huntabyte
@Huntabyte 5 ай бұрын
More to come!
@johnwu8916
@johnwu8916 5 ай бұрын
This was super helpful. I would love to see a tutorial on how to apply some OOP concepts leveraging runes, like how best to encapsulate all the methods and properties inside the model and be able to import it to support universal reactivity. That might be helpful for supporting larger code bases or complex web apps. Thanks! (PS: I am new to front-end dev, and mostly my experience is writing server and other backend codes, so if there is another path to manage complex relationships between objects in svelte/javascript/typescript, I am all ears 😃)
@Huntabyte
@Huntabyte 5 ай бұрын
A video on just that will be uploaded either this weekend or early next week!
@MrWesopl
@MrWesopl Ай бұрын
Exactly. As an old backend dev, I love to keep business logic at one place. Will look up the hopefully uploaded video.
@zsmain
@zsmain 6 ай бұрын
This was very informative, looking forward for similar videos.
@Huntabyte
@Huntabyte 6 ай бұрын
Awesome to hear! Looking forward to making them!
@pjc825
@pjc825 6 ай бұрын
Would love you to show the best approach to handle state in a Svelte5/SvelteKit multi user application so that state is completely isolated for each user since Stores alone are not the proper approach when using SvelteKit, using Context API or whatever is the best way to do this. No videos seem to show the best way to do this (you did touch on it in an earlier video) but I would like to see it in more detail with very clear explanations of why to do it that way. Your videos a really great and you have the ability to clearly and succinctly explain things 💯😃👍
@Huntabyte
@Huntabyte 6 ай бұрын
Thanks for the kind words! That’s absolutely something I can do!
@pfcycletechnology7064
@pfcycletechnology7064 4 ай бұрын
What a great idea. I struggle with that in sveltekit too. If there's someone who could/should get the credit for creating such an informative sveltekit tutorial, it should be here on this channel.
@pfcycletechnology7064
@pfcycletechnology7064 4 ай бұрын
@@Huntabyte Just a suggestion. Moving this shopping cart into a sveltekit project and add user authentication so each cart belongs to a user. That would be informative. So leave this project as is, with svelte5 and start another project in sveltekit with shopping cart and user authentication. Doable? ;)
@Loui3Hunna
@Loui3Hunna 6 ай бұрын
Great as always! Would very much like to see more Svelte 5 API examples :)
@Huntabyte
@Huntabyte 6 ай бұрын
More to come!
@joshua.hintze
@joshua.hintze 6 ай бұрын
Nice video. I would love to know of other good cases to use an effect. Thanks!
@Huntabyte
@Huntabyte 6 ай бұрын
You got it!
@HzClan
@HzClan 6 ай бұрын
Nice video as usual, can't wait to see the filters in action in the next video!
@vinseixas5662
@vinseixas5662 5 ай бұрын
I'm new to Svelte and looking curiously towards Svelte5. I've been following your guides and videos, plus using the shadcn-svelte you worked on. All of the stuff that comes out of this channel is such high quality.
@Huntabyte
@Huntabyte 5 ай бұрын
Hey I appreciate the kind words, I appreciate it! Svelte and its community has been nothing short of incredible! The only bad thing is once you give it a chance, you'll never want to use something else 😂
@lemnisk8
@lemnisk8 6 ай бұрын
Thank you.... Please make more of such videos...
@jmoo4457
@jmoo4457 5 ай бұрын
I think this is a great overview of Svelte 5 runes, but in a real practical application, i would try to divide up the shopping cart logic (add, remove, etc.) into its own so that the logic does not live at UI component levels. Would be cool if you can cover a video on abstracting state and its logic in Svelte something like React's custom hooks so that the logic could be used like `const { add, remove, modify } = $cart` abstracted into its own module.
@Huntabyte
@Huntabyte 5 ай бұрын
Yeah I already have one queued that covers just that 😁
@АлександрПирогов-б7ф
@АлександрПирогов-б7ф 6 ай бұрын
great stuff looking forward to seeing more videos on svelte 5
@Huntabyte
@Huntabyte 6 ай бұрын
Glad to hear it! Looking forward to delivering more!
@MM-uf6kt
@MM-uf6kt 5 ай бұрын
This would be a great series!
@herkulano
@herkulano 6 ай бұрын
Thanks!
@Huntabyte
@Huntabyte 6 ай бұрын
Hey thanks a ton for that! I appreciate it!
@twentxx
@twentxx 6 ай бұрын
Thank you so much! 🙏 Your videos has very useful practical knowledges. Love it
@Huntabyte
@Huntabyte 6 ай бұрын
You’re welcome! Glad you like this format!
@JacobDuenke
@JacobDuenke 6 ай бұрын
Hey, just wondering why do you seem to always use “const” for derived variables, but “let” for state variables?
@imho7992
@imho7992 6 ай бұрын
They’re not editable and they are read only.
@JacobDuenke
@JacobDuenke 6 ай бұрын
@imho I’m familiar with const, just wondering what’s the implications with $derived. The values do change of course, so I would assume you’d need to use let, at least for primitive values. You could get away with const for reference types.
@Huntabyte
@Huntabyte 6 ай бұрын
I use const because _i_ can’t update that value, not that it doesn’t ever update. Whereas with $state I can - just a preference!
@AndreaBarghigiani
@AndreaBarghigiani 2 ай бұрын
Great video man! Please keep up with real use cases video as this one. Also, I love your livestreams as well but since them are just a your stream of thoughts could I ask if you'll be able to extract the juicy parts from them and make shorter video? Tbh it could just be a cut-and-republish kinda of approach, you don't need to re-record the concept, just share it 😅
@d4yno
@d4yno 6 ай бұрын
Absolutetly awesome in depth tutorial.
@Huntabyte
@Huntabyte 6 ай бұрын
Thanks for the kind words!
@Terr590
@Terr590 6 ай бұрын
Love the practical approach in this video, thanks!
@Huntabyte
@Huntabyte 6 ай бұрын
Glad to hear it! These videos are much more enjoyable to make!
@deepjyotideb1173
@deepjyotideb1173 6 ай бұрын
How slow exactly is a reducer? Does using it make it visibly slower?
@Huntabyte
@Huntabyte 6 ай бұрын
It’s many times slower than a loop. Using it in one single place may not create a noticeable difference, but when it’s used many places it can really add up. So for that reason I try to avoid it!
@Add0w
@Add0w 6 ай бұрын
This is really excellent explanation, thank you.
@Huntabyte
@Huntabyte 6 ай бұрын
This is great feedback! Thank you!
@memestagestartup
@memestagestartup 6 ай бұрын
been waiting for your new vids to drop...🥳🥳
@Huntabyte
@Huntabyte 6 ай бұрын
Me too! Took me a while to realize these videos won’t great themselves! 😂
@anuragsingh-ts3nb
@anuragsingh-ts3nb 4 ай бұрын
@huntabye its great how u explained the concept, was struck in a issue what iff, on scroll i have to load more products how that can be handled if you can provide a snippet of a way to go, as currently the data is loaded from a API endpoint in page.ts load function
@tiljaray
@tiljaray 2 ай бұрын
I can't wait to see more svelte 5 videos
@St0rMsk
@St0rMsk 3 ай бұрын
Don't know man, the more I work with svelte, the I like Vue
@hmiiro
@hmiiro 2 ай бұрын
Great Stuff @Hunterbyte as always. any update on new episodes you had in the queue?
@helenrebmann3948
@helenrebmann3948 4 күн бұрын
10/10 - you’re a great help. Thanks
@LarcenIII
@LarcenIII Ай бұрын
Love your videos Huntadev!
@mikeeomega
@mikeeomega 6 ай бұрын
What a great demo of Svelte 5 powers
@Huntabyte
@Huntabyte 6 ай бұрын
Thank you! I’m glad you think so!
@vexkiddy
@vexkiddy 6 ай бұрын
Great video Hunter!
@omargarcia7900
@omargarcia7900 5 ай бұрын
Can you do a few videos on Keras and TensorFlow, please? :) Great content on your channel from what I've seen so far!
@BhideSvelte
@BhideSvelte 6 ай бұрын
It took sooo long...i was waiting...love from India ☺️☺️
@Huntabyte
@Huntabyte 6 ай бұрын
Me too… I just realized these videos won’t create themselves!
@8-P
@8-P 6 ай бұрын
I enjoy watching your videos, thanks alot for this :)
@Huntabyte
@Huntabyte 6 ай бұрын
I appreciate the kind words! Happy to do it!
@WLockIV
@WLockIV 6 ай бұрын
Is it just me or is the derived update more intelligent now? I feel like old derived would have triggered an update each time anyway. Thanks for the video!
@nevillebrem
@nevillebrem 6 ай бұрын
what extensions makes your +page.svelte files to folders?
@Huntabyte
@Huntabyte 6 ай бұрын
It's not an extension but a VSCode setting! "explorer.fileNesting.patterns". I haven't added these settings to my settings repo just yet, but in the meantime you can search "antfu vscode settings" to find comparable ones.
@nevillebrem
@nevillebrem 5 ай бұрын
@@Huntabyte thanks!
@saiphaneeshk.h.5482
@saiphaneeshk.h.5482 Ай бұрын
Very very new to svelte (just planning to start with it actually). Is there a way to have them globally or something like that instead of going through bind n all? Like how redux is used in react?
@ok-alarm
@ok-alarm 6 ай бұрын
more videos like this!
@beeboopmeow
@beeboopmeow 24 күн бұрын
amazing video, congratulations
@robimalco
@robimalco 6 ай бұрын
mind blowing expertise
@Huntabyte
@Huntabyte 6 ай бұрын
Thanks Robi!
@xthesly
@xthesly 6 ай бұрын
Shouldn’t a cart be managed with sveltekit using session and/or db ?
@Huntabyte
@Huntabyte 6 ай бұрын
Of course, but as mentioned in the video, we're focused on the frontend / interactivity rather than the full stack in this video. To integrate it full stack you would just add a few API calls into the mix but the general idea remains the same.
@devbyveritech
@devbyveritech 5 ай бұрын
I love this More of it please
@bnjmn7779
@bnjmn7779 6 ай бұрын
Would be interested to see how to connect this to a backend to save the cart of a user.
@KevinMacKenzie61
@KevinMacKenzie61 6 ай бұрын
Fantastic video. Thanks!
@Huntabyte
@Huntabyte 6 ай бұрын
Thank you, Kevin! Appreciate you being a member for almost 1.5 years now, means a ton!
@KevinMacKenzie61
@KevinMacKenzie61 6 ай бұрын
@@Huntabyte While I appreciate you thanking me for being a member, I wish I could actually pay you what you have taught me is worth. While there are other great teachers on KZbin, no one helps me grasp things like you do.
@SaidElnaffar
@SaidElnaffar 6 ай бұрын
Liked and Subscribed for sure.
@Huntabyte
@Huntabyte 6 ай бұрын
Thank you!
@ElGnomistico
@ElGnomistico 6 ай бұрын
Pleaaaase make more of these
@oeaoo
@oeaoo 2 ай бұрын
Experts, what Svelte is not the best for? I am not in FE at all.
@kson2659
@kson2659 6 ай бұрын
Thanks mate!
@n3x404
@n3x404 5 ай бұрын
love it 🥰
@XiaZ
@XiaZ 21 күн бұрын
Write your own reducer instead of using build in method just for a cart quantity because you think it's slow is the prime example of premature optimization.
@nigelnyakudya2262
@nigelnyakudya2262 6 ай бұрын
We need a rewrite for morden Saas in svelte 5 brother.
@Huntabyte
@Huntabyte 5 ай бұрын
It's coming man! Svelte 5 is still in RC and Bits UI still has some work to do so it's ready to be added into the course as well 😃
@mikejohneviota9293
@mikejohneviota9293 6 ай бұрын
Decaprio is programming again
@RicoGarza00
@RicoGarza00 4 ай бұрын
Svelte 5 is so much more confusing as a beginner.
@Huntabyte
@Huntabyte 3 ай бұрын
If you only have Svelte 4 to compare it against, sure it may seem a bit more daunting, but I promise the complexity curve flattens after you learn the basics, where in Svelte 4 it was basically linear where the more complex the UI the more hacks and complexities required in the code.
@RicoGarza00
@RicoGarza00 3 ай бұрын
​@@Huntabyte Good to know, Svelte 4 is where I started so thats probably why it seems overwhelming. I'll be a little more comfortable once its released and I can start working with it. Thanks for all of the amazing videos btw! They've made me feel much more comfortable using Svelte 4
@greendsnow
@greendsnow 6 ай бұрын
Can't look at it, my eyes hurt. Css please.
@Huntabyte
@Huntabyte 6 ай бұрын
Never
@joseflinha
@joseflinha 6 ай бұрын
Great video, but why name files for components differently than the name of the component itself? CartItem vs cart-item.svelte please CartItem.svelte
@Huntabyte
@Huntabyte 6 ай бұрын
You should look into the annoying things that can arise with git and OS discrepancies depending on how they handle file name case sensitivity. I use kebab case for that reason, but also because it's what I like to use and what I'm most comfortable with. Feel free to use what suites you best!
@joseflinha
@joseflinha 6 ай бұрын
@@Huntabyte Yes, there is a Git setting core.ignorecase for that. If you like such a name... 🙂
Global Stores Are Dangerous
11:48
Huntabyte
Рет қаралды 18 М.
Svelte 5's Secret Weapon: Classes + Context
18:14
Huntabyte
Рет қаралды 30 М.
Svelte 5 Is Like React, But Better
19:33
Theo - t3․gg
Рет қаралды 81 М.
Svelte 5 Ruined Svelte (and that's why I love it)
12:37
Ben Davis
Рет қаралды 13 М.
Svelte 5 Snippets: Revolutionizing UI Composition | Snippets Vs Slots
12:09
Fullstack Ninja Academy
Рет қаралды 2,1 М.
Best UI Library for Svelte
16:13
Huntabyte
Рет қаралды 110 М.
Persistent Stores in Svelte 5
12:37
WebJeda
Рет қаралды 612
Use Svelte 5 Snippets To Reuse Markup Without Creating Components
17:41
Svelte 5: New and Improved by Rich Harris
49:04
Fabian Hiller
Рет қаралды 12 М.
Svelte 5: In Action | Build A Tasks App
21:40
Syntax
Рет қаралды 8 М.
Svelte 5 runes: what's the deal with getters and setters?
11:22
Rich Harris
Рет қаралды 45 М.
Protect SvelteKit Routes with Hooks
21:10
Huntabyte
Рет қаралды 60 М.