Loading Data in SvelteKit (+page.js & +page.server.js)

  Рет қаралды 83,816

Huntabyte

Huntabyte

Күн бұрын

Пікірлер: 277
@Huntabyte
@Huntabyte Жыл бұрын
UPDATE: When destructuring data on the +page.sveltes, do -> $: ( { products } = data ) instead of the way I demonstrated in the video.
@jrmsrs
@jrmsrs Жыл бұрын
4:05 specifically
@pickavana8056
@pickavana8056 Жыл бұрын
no explanation of why you are making this reactive
@Jack-vv7zb
@Jack-vv7zb Жыл бұрын
why
@jean_luc_retard
@jean_luc_retard Жыл бұрын
why
@EvertvanBrussel
@EvertvanBrussel Жыл бұрын
Why indeed?
@libertad83y
@libertad83y 2 жыл бұрын
It's amazing how the same topic explained by 2 different people give so different results! You are a natural born teacher, no AI can replace you soon! 😂
@Huntabyte
@Huntabyte 2 жыл бұрын
Wow, thank you for the kind words. It means a lot! 😄
@darbhasailu
@darbhasailu 2 жыл бұрын
finally someone explaining new sveltekit nuances in a understandable and human friendly way thank you
@Huntabyte
@Huntabyte 2 жыл бұрын
You're very welcome!
@dallenbaldwin3484
@dallenbaldwin3484 2 жыл бұрын
for those coming to this later, we don't even need dotenv to get our env variables. you can import from '$env/static/private'
@Huntabyte
@Huntabyte 2 жыл бұрын
Yes, I completely forgot that it was a thing when I made this video!
@smoqi3387
@smoqi3387 Жыл бұрын
dude, it's the first time i learn something since i started exploring javascript libraries, i tried react, nextjs, vue and some others from other youtubers. Thanks a lot you're definitely one of the best teachers out there.
@MrJoegotbored
@MrJoegotbored 2 жыл бұрын
The documentation of this functionality is less than clear. Been struggling with it for 2 days now and your video instantly cleared up the issue I was having! I'm excited for their beta to be over and for them to get back to documentation, but until then, I have your talent and videos to help me out!
@Huntabyte
@Huntabyte 2 жыл бұрын
I’m glad you found this helpful! Let me know if you have any additional questions or uncertainties!
@kylestubblefield3404
@kylestubblefield3404 Жыл бұрын
I am building a student information system for a local private school, and I stumbled upon your prisma+sveltkit video. I needed more context for the video so I came back to watch all your sveltekit videos. Earned a sub 5 minutes in. Great content, keep up the good work!
@edwarr2
@edwarr2 Жыл бұрын
Thank you thank you thank you. This is the first thing I've encountered that actually explained the difference between page.js vs. page.server.js execution in terms I could understand. Brilliant!
@Huntabyte
@Huntabyte Жыл бұрын
You’re very welcome! Thank you for taking the time out of your day to comment, I appreciate it!
@joelpoh
@joelpoh 2 жыл бұрын
Thank you for putting out this video! The demonstration and explanation was clear and concise and most helpful.
@Huntabyte
@Huntabyte 2 жыл бұрын
You're welcome, I appreciate your feedback! Let me know if there's any other topics you'd like me to cover and I'd be more than happy to consider it!
@joelpoh
@joelpoh 2 жыл бұрын
@@Huntabyte would you consider doing one on how to implement authentication with http-only cookies?
@Huntabyte
@Huntabyte 2 жыл бұрын
​@@joelpoh I sure would! Do you have a specific database preference?
@joelpoh
@joelpoh 2 жыл бұрын
@@Huntabyte thanks and sorry for the slow reply. As for the database, any one is fine
@pickavana8056
@pickavana8056 Жыл бұрын
@@Huntabyte supabase
@mhemaungthuwin7916
@mhemaungthuwin7916 2 жыл бұрын
Currently I'm falling in love with SvelteKit and PocketBase, and your content is the exact things I'm looking for. Thank you so much.
@Huntabyte
@Huntabyte 2 жыл бұрын
I’m glad to hear that! If you have any questions along the way don’t forget we have a discord community to support you!
@mhemaungthuwin7916
@mhemaungthuwin7916 2 жыл бұрын
@@Huntabyte Thank again sir.
@Nrde
@Nrde 2 жыл бұрын
Nothing to add to the previous comments, just adding a comment to help the google algorithm to make this known for wider audience. Very good content!
@Huntabyte
@Huntabyte 2 жыл бұрын
Thank you, I appreciate that!
@charlessexton1483
@charlessexton1483 2 жыл бұрын
You're a legend. I'm getting back into Svelte after many months away and the whole +page stuff is far from intuitive, although the functionality is incredible. You've explained it so well. Thank you.
@Huntabyte
@Huntabyte 2 жыл бұрын
I'm thrilled to hear that! Thank you!
@gangliezhu7951
@gangliezhu7951 2 жыл бұрын
Very concise explanation. Even me, an absolute newbie, can understand. Thank you for creating this video.
@Huntabyte
@Huntabyte 2 жыл бұрын
You're very welcome!
@timsonner
@timsonner 2 жыл бұрын
This SvelteKit video series is super helpful right now, thank you.
@Huntabyte
@Huntabyte 2 жыл бұрын
I'm glad to hear that, thank you!
@markobogosavljevic3336
@markobogosavljevic3336 2 жыл бұрын
Sending a comment for the algorithm lmao. Very nice video dude, I'm glad youtube recommended me this video lmao.
@Huntabyte
@Huntabyte 2 жыл бұрын
I appreciate the algo support 😂 and thank you for the kind words! Please let me know if there's anything else you'd like to see!
@MatheusCardosodeAndradeSilva
@MatheusCardosodeAndradeSilva 2 жыл бұрын
You just cleared the most important thing that was blurring my mind about Sveltekit. Thank you very much!
@Huntabyte
@Huntabyte 2 жыл бұрын
You’re welcome! Let me know if there’s anything else you’d like to see a video on!
@peterhamilton9387
@peterhamilton9387 2 жыл бұрын
Love your style. Fast, informative and concise. Would love you to do a full Svelte Kit tutorial … please.
@Huntabyte
@Huntabyte 2 жыл бұрын
I'm glad to hear that you like the style, I try to make content in the same way I prefer to receive it! Since a full on SvelteKit tutorial with details covering each capability would be a multiple hour long video, I plan on releasing a bunch of videos relating to the individual capabilities first, then a video on building a full-stack application. That way, if anyone gets confused along the way, they can reference these more detailed videos!
@peterhamilton9387
@peterhamilton9387 2 жыл бұрын
@@Huntabyte Sounds awesome! Keep up the good work 👍
@bjul
@bjul 2 жыл бұрын
This was great! Big appreciate. Just getting started with SvelteKit and this cleared up a lot of confusion. Good teaching style. Keep this up!!!
@DrShmuck
@DrShmuck 2 жыл бұрын
Try setting your VS code to sort by filesFirst and increase the size of the indentation. It makes it much easier to kinda grasp which +page belongs to which route.
@Huntabyte
@Huntabyte 2 жыл бұрын
I have tried setting the filesFirst and it felt a little too foreign but I typically have the indentation further when not recording (for screen real estate sake).
@onepointproduction9092
@onepointproduction9092 2 жыл бұрын
Superb..... my head is crystal clear now when i read doc after this videos, thank you so much
@Huntabyte
@Huntabyte 2 жыл бұрын
I'm glad to hear that!
@BryanKlein
@BryanKlein 2 жыл бұрын
I need to update my existing SvelteKit sites and this made the work I have to do very straightforward. Thank you!
@Huntabyte
@Huntabyte 2 жыл бұрын
I’m glad to hear that, thanks for the feedback!
@mxm460
@mxm460 2 жыл бұрын
good video, docs are so confusing without an explanation like this, thanks
@Huntabyte
@Huntabyte 2 жыл бұрын
Thank you! I was also confused at first. The SvelteKit team has admitted that their docs are lacking, especially compared to Svelte’s. We should see improvements to the docs with 1.0!
@mxm460
@mxm460 2 жыл бұрын
@@Huntabyte If you are gonna make more vids like this, I'd like to see one on the new "form actions/enhance" or a general sveltekit API/endpoints tutorial. Thanks again.
@cholasimmons
@cholasimmons Жыл бұрын
"nowadays we're spoilt with internet speeds", i like that line, I tell people too that we are so spoilt by computing power nowadays that few people add efficient methods into their workflow, especially Apple users and Photoshop 🤣
@lucasneuhaus3138
@lucasneuhaus3138 Жыл бұрын
Finding your videos was game-changing in my Svelte learning. Instant subscribe
@Huntabyte
@Huntabyte Жыл бұрын
Thanks Lucas!
@cory2300
@cory2300 2 жыл бұрын
Great video, really clean and concise. The format is awesome! I totally forgot about pre-fetch. Apparently you can even put it on root level tags to apply to your entire app (if you want). Remember Svelte now has in-built handling of .env variables!
@Huntabyte
@Huntabyte 2 жыл бұрын
Thanks for the kind words and feedback! I am aware of the built-in handling of .env vars, old habits die hard and I tend to forget it exists. I will certainly take advantage of them in upcoming videos! Regarding the root-level tags - for this video, I decided that placing them directly on the tags would make it easier for the viewer to understand. Again, thanks for your comment, I really appreciate it!
@MattHeslington
@MattHeslington 2 жыл бұрын
I'm so pleased to have found your channel. I love your style of teaching and can't wait to work my way through the series of SvelteKit tutorials you've now put out. Thank you!
@Huntabyte
@Huntabyte 2 жыл бұрын
Thank you for the kind words! Please let me know if there's anything I can do to help!
@JLO-qy5to
@JLO-qy5to 2 жыл бұрын
Absilutely perfect. The load function was a thing for me that I've wanted to use but have been worried about the functionallity and if I get this running: Your video helped me in just 10 Minutes!
@Huntabyte
@Huntabyte 2 жыл бұрын
That’s awesome to hear! Thank you!
@rossvold
@rossvold Жыл бұрын
Thanks for making this! All i need to learn now is how to do the opposite. Sending data from a from to a database.
@Huntabyte
@Huntabyte Жыл бұрын
You want to look into Server-Sent Events! You'd have to deploy SvelteKit with `adapter-node` for it to work though!
@rossvold
@rossvold Жыл бұрын
@@Huntabyte Thanks for giving me a direction to look 😅
@drinkvodka1831
@drinkvodka1831 Жыл бұрын
This tutorial was exactly what I was looking for. Perfectly explained, thank you.
@Huntabyte
@Huntabyte Жыл бұрын
Glad it was helpful!
@CoreyDamocles
@CoreyDamocles Жыл бұрын
SvelteKit made fetch happen. Great tuts, Huntabyte!
@Huntabyte
@Huntabyte Жыл бұрын
Thanks, Corey!
@luciusrex
@luciusrex 11 ай бұрын
this was super helpful, just the way the information was presented was on point! thanks!
@bmehder
@bmehder 2 жыл бұрын
Great explanation. I am looking forward to watching all the videos in this playlist.
@Huntabyte
@Huntabyte 2 жыл бұрын
Thank you! I’m glad you’re here!
@DionisiusWahyuAdiSaputra
@DionisiusWahyuAdiSaputra 2 жыл бұрын
Crisp & clear! Deserves mor subs. Keep it coming man.
@hello_world_104
@hello_world_104 2 жыл бұрын
I had no clue about what server really meant or realize that stuff could occur in hosting env before sent to client. I thought ssr still happened on client computer in some behind the scenes thing. Very cool
@Huntabyte
@Huntabyte 2 жыл бұрын
Glad you could learn something here!
@achequisde
@achequisde 5 ай бұрын
For those coming after SvelteKit migrated to v2.0: load functions don't automatically await for top-level promises anymore. You should use await as in the first version (still blocking), or await Promise.all([...]) to avoid the waterfall.
@felipebereilh3856
@felipebereilh3856 2 ай бұрын
Thanks!
@Xavi7th
@Xavi7th Ай бұрын
How can we do this?
@joewilliams8286
@joewilliams8286 Жыл бұрын
Just found your channel bro, great explanation! Thanks for taking the time to create these tutorials for us. 1+ sub
@paterfamilias01
@paterfamilias01 2 жыл бұрын
So great to see some updated tutorials on sveltekit.
@bobbyLovesTech
@bobbyLovesTech Жыл бұрын
THANK YOU SO MUCH! This is perfect. Just getting started with Sveltekit and it makes sooo much sense
@MarkDacre
@MarkDacre 2 жыл бұрын
I'm officially a fan of your teaching style. I don't usually comment but wanted to add my voice to the growing chorus. I'm glad you post this stuff for free (how else would I have found you!) but I'd gladly pay for an in-depth Sveltekit course.
@Huntabyte
@Huntabyte 2 жыл бұрын
Thank you! That means a lot!
@JacobDuenke
@JacobDuenke 2 жыл бұрын
Really great video! We’ll put together and little to no faffing about getting to the main points.
@Huntabyte
@Huntabyte 2 жыл бұрын
Thank you!
@nickstaresinic9933
@nickstaresinic9933 2 жыл бұрын
Really stands out as very well done: important content, clear organization, & concise presentation. Thanks.
@Huntabyte
@Huntabyte 2 жыл бұрын
Of course! Thank you so much for the feedback!
@DavePerth
@DavePerth 2 жыл бұрын
Awesome, thanks so much - would to see this extended to run through a CRED example - maybe using Supabase or Railway db!
@Huntabyte
@Huntabyte 2 жыл бұрын
Noted! Thank you for the suggestion! That's definitely something I will consider.
@danielkott4772
@danielkott4772 2 жыл бұрын
Great content and clear explanation. Hoping for some more sveltekit videos in the near future, and maybe even a projects utilizing its features. Keep it up!
@Huntabyte
@Huntabyte 2 жыл бұрын
Thank you, I appreciate the kind words! I’m working on covering all the basics first, so that when I do create some projects, I won’t have to go in as much detail on all these individual parts!
@svelterust
@svelterust Жыл бұрын
This is really useful stuff that anyone that uses SvelteKit should know 😄
@marktwain3083
@marktwain3083 Жыл бұрын
Prefetch is now implemented by default in SvelteKit. It's been renamed to "preload" and you can now choose if you want it to be activated on hover (default) or on click.
@ksjitendra18
@ksjitendra18 2 жыл бұрын
Wow man. What an explanation. Very helpful video. Can't thank you enough for this.
@Huntabyte
@Huntabyte 2 жыл бұрын
Thank you! I'm glad it helped!
@mohammad-aminebanaei886
@mohammad-aminebanaei886 2 жыл бұрын
Amazing, I had trouble understanding the new version of sveltekit and you helped alot.
@mikeeomega
@mikeeomega 2 жыл бұрын
I really like the way you explained this... hope to see more content from you
@Huntabyte
@Huntabyte 2 жыл бұрын
Thank you! You can certainly expect that!
@petemoss3160
@petemoss3160 Жыл бұрын
didn't realize this was exactly what i needed to know.
@codenx2
@codenx2 2 жыл бұрын
Very clear. No confusion at all.
@mrbjjackson
@mrbjjackson Жыл бұрын
Excellent video thanks. Instant subscribe as I'm just digging into Sveltekit now.
@Huntabyte
@Huntabyte Жыл бұрын
Awesome to hear! Thanks for subscribing!
@AB-gx5zj
@AB-gx5zj 2 жыл бұрын
Really good videos. Makes learning sveltekit much easier, thank you!
@Huntabyte
@Huntabyte 2 жыл бұрын
Thank you!
@babyfeavel71
@babyfeavel71 Жыл бұрын
Very good explanation of the topic.🎉 I hope you can explain how to insert/update/delete rows with Supabase and Svelte Kit.
@zzej
@zzej 2 жыл бұрын
straight to the point well explained. please consider posting more content on sveltekit :D
@Huntabyte
@Huntabyte 2 жыл бұрын
I certainly will! Anything in particular you’d like to see?
@zzej
@zzej 2 жыл бұрын
@@Huntabyte Cookies, authentication, user session changed recently and I want to try to understand it better. It confuses me as to where exactly should I do authorized api calls page.server.js or page.js or page.svelte too many pages (this was helpful). Thanks for the reply!
@Huntabyte
@Huntabyte 2 жыл бұрын
@@zzej Noted & added to the list. Thank you for your feedback and suggestions! I greatly appreciate it!
@justinoneill2837
@justinoneill2837 2 жыл бұрын
Big question in my mind is when to use the *load* function VS *store* VS *context* and how/if they tie together ... And then the best way to tie in *localstorage* / *db* / *websockets* . AND THEN the question, does it even make sense to use Svelte *{await}* blocks or native *fetch()* at the component level EVER AGAIN at this point? Why or Why not? Seems like there should be a recommended order for this but there's so many options. Would be awesome if you did a part 2 deep dive video on this! Keep up the great content bro!! Subscribed!!!
@JOCS20
@JOCS20 2 жыл бұрын
Super helpful video. Thank you for taking the time to explain this so clearly and concisely. Bravo! Liked & Subscribed
@Huntabyte
@Huntabyte 2 жыл бұрын
Thank you, I appreciate that!
@DamonMedekMusic
@DamonMedekMusic Жыл бұрын
Very great videos, I think you cover the back-end Sveltekit the best so far. Others teach a bunch of work arounds that won't work when you go into production. Thank you! I still have a lot to learn about importing local file json and editing it in the backend and returning it to client, like a poor mans database. It seems +page.server.js doesn't give me access to Node (fs) like I hoped.
@Huntabyte
@Huntabyte Жыл бұрын
No, it doesn't :/
@DamonMedekMusic
@DamonMedekMusic Жыл бұрын
@@Huntabyte I think actually you can, fs.writeFileSync works inside load method or action post methods. with a try catch.
@Huntabyte
@Huntabyte Жыл бұрын
@@DamonMedekMusic Oh yes if you are running it on a node server but I believe with serverless you won't have that luxury. Added to my list of things to explore.
@bonclairvoyant
@bonclairvoyant 2 ай бұрын
Thank you for this video, Hunter🙌.
@kiana5066
@kiana5066 Жыл бұрын
today I learned: devtools panel has its own command pallet 🤯 thank you!
@andrewkillen5879
@andrewkillen5879 2 жыл бұрын
great stuff. many thanks, its really made the recent breaking changes easy to pallet.
@BoukeGroenescheij
@BoukeGroenescheij 2 жыл бұрын
Amazing. Great helpful content which is to the point, and extremely well explained. I agree with all the comments, thank you so much! I'll hop on your Discord 🙂.
@didiercatz
@didiercatz 2 жыл бұрын
Wow, what a great pace and explanation style. Instant sub.
@Huntabyte
@Huntabyte 2 жыл бұрын
Thank you!
@Allformyequine
@Allformyequine 2 жыл бұрын
So great! I learned a ton from this one!! Keep the SKit tuts going :) !!!
@Huntabyte
@Huntabyte 2 жыл бұрын
More to come!
@LJ81824
@LJ81824 2 жыл бұрын
I wish I could thumbs up more than once!
@Huntabyte
@Huntabyte 2 жыл бұрын
Thank you!
@shmusiccomp9417
@shmusiccomp9417 Жыл бұрын
Is data-sveltekit-prefetch now data-sveltekit-preload-data? It seems to work the same and that's what shows in VS Code auto-complete rather than the prefetch variety. Thanks for this video! Your teaching style is inspiringly clear!
@Huntabyte
@Huntabyte Жыл бұрын
Yes!
@shmusiccomp9417
@shmusiccomp9417 Жыл бұрын
@@Huntabyte Just FYI for anyone else wondering, documentation for dotenv import is : import { YOUR_PRIVATE_KEY } from '$env/static/private'
@LuigiVampa9
@LuigiVampa9 2 жыл бұрын
Can't wait for more! Very informative, concise presentation. Subscribed :)
@Huntabyte
@Huntabyte 2 жыл бұрын
Thank you for the kind words and feedback! I already have a few more videos in the works at the moment!
@RicardoCamisa
@RicardoCamisa Жыл бұрын
Thanks so much for the wonderful class. Could you teach how to generate PDF with SvelteKit?
@Huntabyte
@Huntabyte Жыл бұрын
This is something I may consider in a future video, but if you can figure out how to generate one with Javascript, you could apply the same within the tags of your Svelte pages.
@RicardoCamisa
@RicardoCamisa Жыл бұрын
@@Huntabyte Thank you for your consideration
@enkioki
@enkioki Жыл бұрын
Love the thumbnail design btw
@Huntabyte
@Huntabyte Жыл бұрын
Thank you!
@garethloot
@garethloot 2 жыл бұрын
Hi there, really nice tutorials. I can not seem to find how you would do pagination with this setup. Does anybody have an idea how i trigger a reload with a button and getting the next batch to show?
@Huntabyte
@Huntabyte 2 жыл бұрын
You'd most likely want to take advantage of route params, so going to page/2 would show the 2nd batch of data for example.
@garethloot
@garethloot 2 жыл бұрын
Thanks, I was thinking to much from a single page application perspective but from a server side perspective that makes more sense.
@Antonio-fo4fl
@Antonio-fo4fl 2 жыл бұрын
This is weird I commented on this vid like 2 days ago saying that @ 11:40 you don’t have to use dotenv because you can use sveltekits built in env variable management. I guess maybe because I had a link to the sveltekit docs. But search up environment variables in the docs :)
@Huntabyte
@Huntabyte 2 жыл бұрын
Old habits die hard I guess! I will definitely check the docs for the best way to use env vars within SvelteKit. Thank you!
@Huntabyte
@Huntabyte 2 жыл бұрын
Also, I believe if you add links, KZbin will automatically remove the comment.
@ridass.7137
@ridass.7137 Жыл бұрын
Quick question: in shop/+page.js there is limit=10 at the end of url, what would be the best practice to increase this number from frontend with something like select input "Products per page"?
@Huntabyte
@Huntabyte Жыл бұрын
You could do a force navigation or call goto() with the updated URL
@GaspyKun
@GaspyKun 7 ай бұрын
Really really amazing video, thanks for making this 🥰
@T--T
@T--T 2 жыл бұрын
thanks man, learning this framework so loving these vids!
@omedjamal7509
@omedjamal7509 2 жыл бұрын
does the prop name inside shop(+page.js) should always be (data)? is this a constant name or we can change to something like(export let allProducts), which i did, but got an error?
@Huntabyte
@Huntabyte 2 жыл бұрын
Good question. It is always data. If you returned `allProducts` for example, you would access that with `data.allProducts`
@meaningmean
@meaningmean 2 жыл бұрын
Nice video. Look forward for more sveltekit videos. TQ
@Huntabyte
@Huntabyte 2 жыл бұрын
Thank you! I look forward to creating more for you!
@benbowden1827
@benbowden1827 Жыл бұрын
Loving these clips! Explanations are on point. Are we still subject to cors issues if using page.server.js ? Was going to spin up a proxy but still learning...
@benbowden1827
@benbowden1827 Жыл бұрын
Nevermind... set it all up through the vite configuration file. Super easy!
@kvetoslavnovak423
@kvetoslavnovak423 2 жыл бұрын
Great to see new uptodate SvelteKit stuff
@Huntabyte
@Huntabyte 2 жыл бұрын
I'm glad to hear that!
@heldim92
@heldim92 Жыл бұрын
Hey! Is this playlist teaching about sveltekit 1.0 or the previous version? I'm a complete beginner looking for resources...
@Huntabyte
@Huntabyte Жыл бұрын
This is pretty much 1.0 - there have been minor changes since the time I recorded and today but nothing major. If you look at the comments usually viewers will point out any small syntax changes.
@heldim92
@heldim92 Жыл бұрын
@@Huntabyte Nice! Thanks for the fast reply. I'll use your videos then! Keep going!
@mr.namazu1023
@mr.namazu1023 2 жыл бұрын
Ive got a question on this: For example ive been using an API which has a request limit of 20 req/s and im using this on a +page.js.. do my server gets "banned" if 20+ users call the site for the same time because its fetching client AND server side? Or same at the page.server.js.. everytime a user clicks the Movie page the server is fetching the API, right? So Request Limits are a bit crashing everything, right?
@Huntabyte
@Huntabyte 2 жыл бұрын
You are correct about that. I briefly looked into solutions for this but became sidetracked with something else, as I also had a similar situation with a side project. I plan to do some more research to find a feasible solution in the near future.
@mr.namazu1023
@mr.namazu1023 2 жыл бұрын
​@@Huntabyte Ok thanks I have the confirmation for it now :) In my current project I work a lot with such an API and would like to do more server sided... but so easy in that case not possible. But I'm already thinking about hosting the API myself to get around this
@loutremount860
@loutremount860 Жыл бұрын
informative video thanks. but I have two very important question 1. when you on movies page and click movies link again its not call second time to page.server.js. (you have to refresh browser) is it bug? 2. fetch url actually expose when look at page source on browser. so what you mean as saying api url will not expose.
@artneo7
@artneo7 Жыл бұрын
Awesome tutorial, thank you so much!
@Huntabyte
@Huntabyte Жыл бұрын
You're very welcome!
@muhammedhalilovic8561
@muhammedhalilovic8561 2 жыл бұрын
Helped out a ton! Great work and thanks a bunch!
@newbreed0707
@newbreed0707 2 жыл бұрын
Great video and easy to follow along subscribed! If you could do a tutorial on how to best work with local storage and indexed db using sveltekit that would be awesome because working with client side api during dev is frustrating so far.
@justinoneill2837
@justinoneill2837 2 жыл бұрын
I second that! Big question in my mind is when to use the *load* function VS *store* VS *context* and how/if they tie together ... And then the best way to tie in *localStorage* / *db* / *websockets*. AND the question, does it even make sense to use Svelte *{await}* blocks or native *fetch()* at the component level EVER AGAIN at this point? Why or Why not? Seems like there should be a recommended order for this but there's so many options. Would be awesome if you did a part 2 deep dive video on this! Keep up the great content bro!! Subscribed!!!
@Shaparder
@Shaparder 2 жыл бұрын
God damn your Svelte videos are just top notch !!
@Huntabyte
@Huntabyte 2 жыл бұрын
Thank you!
@kanways8
@kanways8 Жыл бұрын
can we use axios inside load function to load data ?
@ismailakyayla7014
@ismailakyayla7014 Жыл бұрын
Great explanation. Thank you.
@Huntabyte
@Huntabyte Жыл бұрын
Glad it was helpful!
@parshantsingh9633
@parshantsingh9633 Жыл бұрын
Can we have both +page.server.js and +page.js ? Which will be given preference for the "data" variable in +page.svelte ?
@Huntabyte
@Huntabyte Жыл бұрын
Yes you can. If they are both returning the same properties, the +page will overwrite the +page.server. This is only if they are returning the same properties, otherwise they will be combined into a single return object.
@castro6612
@castro6612 Жыл бұрын
Does using the load function also prevents memory leaks?
@katewykes4850
@katewykes4850 9 ай бұрын
This may be off topic - but what extension are you using to get the browser to show (with multiple tabs) in the visual code?
@MosiurRahman-dl5ts
@MosiurRahman-dl5ts Жыл бұрын
Is it safe to use async await without a try catch block? how are the errors handled?
@Huntabyte
@Huntabyte Жыл бұрын
SvelteKit does handle them generically when in load functions but in reality you should be catching/handling them.
@Bukosaure
@Bukosaure Жыл бұрын
Excellent content, truly.
@Huntabyte
@Huntabyte Жыл бұрын
Thank you!
@idrissyed8989
@idrissyed8989 2 жыл бұрын
Is there a way to cache the data in the load function and not refetch on the route update(going back and forth)?
@Huntabyte
@Huntabyte 2 жыл бұрын
This is certainly possible! I will make a video soon for this.
@bosung90
@bosung90 Жыл бұрын
Is it possible to return stream of data from server loading? (for example, used in infinite scroll loading)
@Huntabyte
@Huntabyte Жыл бұрын
I'm looking into this soon, I believe it would have to be client-side fetch requests rather than being loaded from a load function, don't hold me to that though.
@bosung90
@bosung90 Жыл бұрын
@@Huntabyte It will be interesting to have this on both sides. SSR for initial load and additional load from client side
@timeforrice
@timeforrice Жыл бұрын
Good stuff!! Now joining your Discord~~!!
@Huntabyte
@Huntabyte Жыл бұрын
Awesome!
@trevordixon4503
@trevordixon4503 Жыл бұрын
With svelte, what is practice if you have the same external api calls,, that need to be accessed from a number of pages? Can you make a global js page and import when needed into a specific page?
@8DMafia
@8DMafia Жыл бұрын
Wonderful video 👋
@Huntabyte
@Huntabyte Жыл бұрын
Thank you!
@simply-dash
@simply-dash Жыл бұрын
what theme do you use
@Huntabyte
@Huntabyte Жыл бұрын
GitHub Dark!
@simply-dash
@simply-dash Жыл бұрын
@@Huntabyte thanks :)
@ikai2
@ikai2 Жыл бұрын
great video, I have a silly question I want to fetch data but only when I submit the form, the load function does fetch automatically on the +page.server.js how do I prevent that
@Huntabyte
@Huntabyte Жыл бұрын
You can use a form action and return it via ActionData
@ikai2
@ikai2 Жыл бұрын
@@Huntabyte thank you, I'll look into that and how to use it. I'm still newbie in svelte and would love to see more of your content.
@CakRama01
@CakRama01 Жыл бұрын
great content, i have question. how about we want fetch and pass data from the client? let say we want GET /shop?page={dynamic} and then page re fetch the data?
@Huntabyte
@Huntabyte Жыл бұрын
I have a video about dynamic routes that may assist with that!
@amanuelelhanan4716
@amanuelelhanan4716 10 ай бұрын
Thank you for tutorial, but I couldn't still figure out how to update the data being sent when users clicks on refresh. It would be best if you could give such examples
Dynamic Routes & Slugs with Route Params
8:55
Huntabyte
Рет қаралды 22 М.
Правильный подход к детям
00:18
Beatrise
Рет қаралды 11 МЛН
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
TryHackMe's Day 15 of Advent of Cyber 2024
35:15
MBxCyberSec
Рет қаралды 796
Avoid Leaking User Data In Your SvelteKit App
24:31
Joy of Code
Рет қаралды 5 М.
Form Actions Made Simple
29:04
Huntabyte
Рет қаралды 37 М.
Why Your Load Functions are Slow
8:24
Huntabyte
Рет қаралды 21 М.
Global Stores Are Dangerous
11:48
Huntabyte
Рет қаралды 18 М.
Use Svelte 5 Snippets To Reuse Markup Without Creating Components
17:41
Sveltekit Data Fetching in 2024 Explained
19:59
Ben Davis
Рет қаралды 10 М.
Practical Svelte 5 - Shopping Cart
25:10
Huntabyte
Рет қаралды 21 М.