React Router v6.4 ( v6.4.1 ) - Fetch data with loaders

  Рет қаралды 12,346

Weibenfalk

Weibenfalk

Күн бұрын

Learn how to use loaders in React-Router version 6.4 ( 6.4.1 ). A new way to fetch data before your component renders. Implemented with Typescript and Vite.
Code:
github.com/wei...
Article by Dominik about using React-Router in combination with React-Query:
tkdodo.eu/blog...
Support me by subscribing to this channel ❤️
Do you want to master #react, #gatsby, or #svelte fast? ⏩ 🚀 👩‍🚀
Check out my premium courses at www.weibenfalk...
-
Find me somewhere below:
Linkedin: / thomas-weibenfalk-7635...
Twitter: / weibenfalk
Github: github.com/wei...
FreeCodeCamp: www.freecodeca...
Dev.to: dev.to/weibenfalk

Пікірлер: 46
@llwebstylell242
@llwebstylell242 Жыл бұрын
Спасибо за видео) Разработчики react-router-dom - реально молодцы.
@callthecapital8631
@callthecapital8631 2 жыл бұрын
Amazing demo, thank you. Could you build the same app with loaders + react query and touch on when we might need to reach for a global state manager?
@Weibenfalk
@Weibenfalk 2 жыл бұрын
You’ve got context built into react. That’s the only global state manager I use ;)
@GauthierEHOLOUM
@GauthierEHOLOUM Жыл бұрын
How to use hook with loader? I've turned supabase sdk client into hook so when tring to access client in loader through hooks can't work
@kkapgm
@kkapgm Жыл бұрын
thank you for this video, react-router v6.4.1 looks mazing with new api, hooks and this data loader, but their documentation sucks, I could never get my head around reading their documents, your video makes it simple. Keep making such great, learning videos. if possible please make a video for react-router with react query
@BenMakerProducer
@BenMakerProducer Жыл бұрын
Great video ! It would be great to see how to use loaders with useQuery 😄
@omnimathic
@omnimathic Жыл бұрын
Hello there, again me. How how can we use useLoaderData hook in nextjs, because I am comfused that nextsj manages routes with in build library without react-router-dom?
@Weibenfalk
@Weibenfalk Жыл бұрын
Yeah this is not for nextjs
@flowerofash4439
@flowerofash4439 Жыл бұрын
after this video now i've seen two people explaining react rotuer loader nicely without telling them what to do with the loading delay when the app do the request. not everything is a localhost
@racine1866
@racine1866 Жыл бұрын
There is a way to show a loading component while the fetch is going? because if the fetch is slow the user will not know what is happening
@Weibenfalk
@Weibenfalk Жыл бұрын
This is usually the thing with Server side fetching as it's fetching before the page is rendered. If you look at good old Wordpress sites there's no loading spinner. =) The data is being fetched before the HTML is rendered to the DOM. That shouldn't take too long if there's not a lot of data or a slow API. Loading indicators is usually used on Client side fetches.
@racine1866
@racine1866 Жыл бұрын
@@Weibenfalk thank you for the response.
@СемёнЗахаренко-л8з
@СемёнЗахаренко-л8з 11 ай бұрын
Thanks. I found the answer to my question in your video.
@craigjohnson8279
@craigjohnson8279 2 жыл бұрын
I think this is similar to TanStack React Location? Great video Thomas!
@pyrocentury
@pyrocentury Жыл бұрын
Thank you for the video. I have maybe a dumb question regarding typescript. How were you able to find out that the 'LoaderFunctionArgs' type definition is provided by react-router-dom? I don't see any relevant documentation on their website or github.
@Weibenfalk
@Weibenfalk Жыл бұрын
I checked the files for react-router in the node-modules folder =)
@MyALPHAguy
@MyALPHAguy 2 жыл бұрын
Hey could you make a full tutorial on React Router v6.4.1? Like building something with it using popular methods?
@Weibenfalk
@Weibenfalk 2 жыл бұрын
I think this one covers a lot of ground on how to structure and build the routes ...
@koronci
@koronci Жыл бұрын
useQuery and a loading indicator would be useful
@fotojt79
@fotojt79 Жыл бұрын
Thank you for the video! Is there a way to use useLoaderData for 2 different fetches, for when you need data from 2 api routes pre-loaded?
@Weibenfalk
@Weibenfalk Жыл бұрын
Haven’t tried but guess you can just fetch them and await both of them as usual
@fahimulhoque9324
@fahimulhoque9324 2 жыл бұрын
Thanks a lot. Your contents are informative and awesome always.
@RachitGuptacool
@RachitGuptacool Жыл бұрын
Please suggest how to integrate redux state with loader.
@christianangelomsulit3759
@christianangelomsulit3759 2 жыл бұрын
Nice content ☺
@Weibenfalk
@Weibenfalk 2 жыл бұрын
Thanks, appreciate the support.
@Sylar7773
@Sylar7773 Жыл бұрын
Thank You very much!!! Greate job!!!
@BobbyW0nder
@BobbyW0nder Жыл бұрын
Excellent video, it's the perfect introduction to React Router v6.4 with Typescript! Thank you so much 🙏
@Weibenfalk
@Weibenfalk Жыл бұрын
Thanks. Appreciate it. =)
@AMoktar
@AMoktar Жыл бұрын
Thanks, what about protected routes ?
@toxirbekabdullaev2082
@toxirbekabdullaev2082 Жыл бұрын
can you also add time code in video, please)
@omnimathic
@omnimathic 2 жыл бұрын
Hello there, I am learnig react now, I have question that Can I pass the pokemon name and image link from Root component to its children when exact pokemon link clicked on Root component, instead of refetching every pokemon on Pokemon component? Thank you in advance!
@Weibenfalk
@Weibenfalk 2 жыл бұрын
I'm not refetching every pokemon in the Pokemon component. Only the data for that specific Pokemon are fetched. If you want to pass the pokemon name and image link to that specific component from the Root you can do that by URL params and grab them in the Pokemon component as I do now with the name.
@omnimathic
@omnimathic Жыл бұрын
@@Weibenfalk Yes, you are absolutely right. I did not relaise you are fetching names first then fetching pakemon data with that names. Thank you. Sorry for misunderstanding.
@tomaszstec5672
@tomaszstec5672 2 жыл бұрын
I liked this one as all your content
@MightyKingKala
@MightyKingKala 2 жыл бұрын
what's your vs code theme? looks amazing!
@Weibenfalk
@Weibenfalk 2 жыл бұрын
One monokai 80s
@samakshgrover7437
@samakshgrover7437 Жыл бұрын
Very well explained 👍
@johnkucharsky6927
@johnkucharsky6927 2 жыл бұрын
Hello, can you give me advice where to look for a job as a web developer. Where did you find your job?
@Weibenfalk
@Weibenfalk 2 жыл бұрын
Hard to guide you there. I’m a freelancer and contact companies that I feel interesting to work with. It can be tough from time to time but don’t give up!
@johnkucharsky6927
@johnkucharsky6927 2 жыл бұрын
@@Weibenfalk what part of your earnings comes from youtube? I've just started, i make 600 dollars a month. I'm looking for a ways to impove my skills and make more
@Weibenfalk
@Weibenfalk 2 жыл бұрын
Everything is possible. But I'm far from it..I can't really understand how you can make 600 dollars a month on your YT channel. Seems impossible if you just started.
@johnkucharsky6927
@johnkucharsky6927 2 жыл бұрын
@@WeibenfalkI started working as a web developer, I have a job. I don't have a KZbin channel. Now I want to find another job because I need more money. By the way, great video, I liked it. Also, I watch a lot of KZbin channels about programming and I see that consistency is important here. I do not know if it is worth trying to shoot a video on KZbin. I have no experience, but in any case, most of the audience does not understand programming, so I can shoot maybe short videos, about an hour long, about main concepts, react
@TheTeup
@TheTeup 2 жыл бұрын
Tack för en bra video 😊
@adityakamble7004
@adityakamble7004 2 жыл бұрын
Awesome as always!!!😍
@Weibenfalk
@Weibenfalk 2 жыл бұрын
Thanks! =)
React router crash course
55:54
Hitesh Choudhary
Рет қаралды 39 М.
Nastya and balloon challenge
00:23
Nastya
Рет қаралды 70 МЛН
Миллионер | 1 - серия
34:31
Million Show
Рет қаралды 2,2 МЛН
I Waited 3 Years For This Router. It STILL Blew My Mind.
21:30
Theo - t3․gg
Рет қаралды 100 М.
Is Tanstack Router Better Than React-Router?
18:00
Jack Herrington
Рет қаралды 37 М.
Goodbye, useEffect - David Khourshid
29:59
BeJS
Рет қаралды 500 М.
Don't Use Websockets (Until You Try This…)
6:46
Code With Ryan
Рет қаралды 305 М.
The Most Important Design Pattern in React
35:04
Cosden Solutions
Рет қаралды 59 М.
This is the Only Right Way to Write React clean-code - SOLID
18:23
3 Beginner React Mistakes That Can Ruin Your App
20:19
Web Dev Simplified
Рет қаралды 105 М.
Apprendre React : React router dom
24:12
Grafikart.fr
Рет қаралды 19 М.
How Did I Not Know This TypeScript Trick Earlier??!
9:11
Josh tried coding
Рет қаралды 213 М.
React Router in Depth #6 - Loaders
12:07
Net Ninja
Рет қаралды 58 М.