Loved this comparison. Rtk query vs react query could also be an interesting discussion topic.
@jherr3 жыл бұрын
You read my mind. Let's see how this one does.
@saakshyadevat96123 жыл бұрын
@@jherr another suggestion. How these new rest api handling libraries like rtk query and react query compare to using graphql clients like apollo. Thanks for all the effort you put in all your videos jack. :D
@jherr3 жыл бұрын
@@saakshyadevat9612 Yeah, I'm gonna start off with REST and see how that goes and then see if folks are also interested in GraphQL. But if you really want to see this happen. Post about this video on social media! Let folks know you like it and the channel.
@saakshyadevat96123 жыл бұрын
@@jherr will surely do👍
@alonfai3 жыл бұрын
I would like to see SWR also compared with all options together : RTK Query, React-Query, SWR and Apollo (both for REST and GraphQL)
@AliAlmahdi3 жыл бұрын
You are a great teacher, I remember reading all the documentation when redux was the hype. I wish you did this video back in that time, would have saved me a lot of time. Now, In many apps, similar to this kind, I’d rather use SWR or React-Query for this kind of state management. Rest of state, either Valtio, Zustand or rxjs.
@jherr3 жыл бұрын
I've got some more code ready to go.
@AndyHoebeke2 жыл бұрын
@@jherr A comparison with useSWR would be great. However, using Sagas with RTK Query (or others like useSWR?) seems interesting but rarely addresses because.. too "advanced" or simply not recommended (in that case what would better? why? --> great content?) :-)
@raskardev27373 жыл бұрын
This kind of videos really demonstrate how RTK can simplify and make more with less. Redux Saga is awesome but I think that I'm going with RTK for future projects! Nice video as always, Jack 👌👌
@krishgarg28062 жыл бұрын
I think for personal projects, swr or react-query would be better because of better DX.
@narcissisticnarcissus49563 жыл бұрын
You knowledge is so solid. I feel like you don't have to google around and read documentation. Instead you just know everything from the ground up.
@jherr3 жыл бұрын
I definitely use Google a ton. Thank you for the compliment though.
@aksyonov1003 жыл бұрын
If you want to loose half of your team, introduce redux-saga into your project. The amount of boilerplate code is enormous, complexity through the roof, nobody wants to support that
@_benjimouse_3 жыл бұрын
It really feels like sagas are a hang over from class components, classic redux days. In 5 years of using them on a variety of projects, I've never seen anyone do anything with them, other than just call an api, handle the errors, and dispatch result to the store. Why even bother.
@voidreact3 жыл бұрын
@@_benjimouse_ I feel that for simple use cases like that Redux sagas are way too complex and way too overkill. I'm working on a complex project where there is conditional data fetching based on other data fetched, so it's easier to write and maintain that in a saga than in a react hook or component
@_benjimouse_3 жыл бұрын
@@voidreact Yeah, sounds like a good use case for them. I just wish the api was more like hooks...
@Oswee3 жыл бұрын
Doesn't that depend on the project you are working on? Imagine large scale real-time enterprise app where the eventual consistency is in it's DNA. Sagas is really great and they help to modularize the codebase tremendously. Blaming and running away is for those who are not willing to learn i guess.
@portalplays37602 ай бұрын
Sagas are great for complex apps that require organised management of side effects. These newer libraries with less boilerplate are missing some key features that sagas give you that you won't realise you need until you are already invested. Be careful following hype trains.
@dgcp3543 жыл бұрын
When you said no bs TS you where not joking, great video as always
@andrewwall2730 Жыл бұрын
redux-saga is my fav. It has so many features(handling external events, concurrency) and sagas are easily testable and code very clear and concise.
@idevbrandon3 жыл бұрын
You read my mind! i was studying Redux middlewares and now faced to RTK Query. i was like why there's so many redux sth bla bla haha Thank you so much!
@andreicojea2 жыл бұрын
This channel should receive more love ❤️
@xdrap13 жыл бұрын
Redux Saga is advanced because you will deal with generator and everything but the downsize is verbosity; RTK Query is easy and more simple to use but unlike React Query, you don’t have a infinite scroll implementation. At the same time React Query hasn’t a stable persist store implementation like RTK has. So yeah, sadly none of them got all the features so you need to choose which one will fit better for the work.
@SmartWizzard3 жыл бұрын
Excellent timing, I was looking into these only.
@zerocodercool3 жыл бұрын
Excellent explanation! I use them both in different packages on a monorepo archiecture.
@YuriiKratser3 жыл бұрын
Thanks! As always you are on top. It'd be cool to have a similar video with react-query.
@techworld30433 жыл бұрын
. Lol i don't know about React but i still watch your videos for fun 😂
@jherr3 жыл бұрын
Thanks! I try to keep it entertaining!
@marouaniAymen3 жыл бұрын
Thanks for the video, actually we use redux-saga as a middleware for redux in order to manage asynchronous calls, we structured the state as the following { data: null, loading: false, failure: false, error: null }, so we init loading at true inside the saga "function generator" at start then we call the api with axios when data come loading is set to false but in case of error we set loading to false and set failure to true with error message in error. My UI components (spinner, notification toasters) shows and hides when those attributes in the store changes. But I'm thinking to use react-query, I fond it more intuitive and reduces the amount of code w are using with redux and redux-saga. Thanks again for the video, like your channel.
@mahmoudjbour73222 жыл бұрын
React-query is a server state only, it won't reflect the UI state, which will force you to write more code and it will be resulted in a buggy code.
@ilyastrus47703 жыл бұрын
There is actually not much sense to compare rtk query and sagas. You can easily use both at the same time! Rtk query, react-query, swr, etc are made specifically to solve your typical problems when working with network (caching, bad internet, boilerplate, loading state...). You shouldn't use sagas for these! Instead, it can be used to handle complex flows, when you need debouncing, throttling, cancellation, race conditions etc. Another use case is sending some analytics or writing user preferences to localstorage on various redux actions. In that case you can easily plug in/out these side effects, without changing the main code. Websockets are also playing nice with sagas(with a little help of saga channels). I, actually, haven't use redux much lately, but still in love with some of the sagas concepts. Especially with redux-toolkit, when you don't have to write all that redux boilerplate nonsense
@jherr3 жыл бұрын
Yeah, that's the point I was trying to make at the end there that the two systems cover fairly different ground. Sagas is great at handling complex asynchronous interactions. And RTK Query is excellent at in-depth query management. And you are right they, could make for a great team.
@abhvr3 жыл бұрын
The transition at 0:20 🤩
@BlinkByteChannel3 жыл бұрын
Can you do a video on optimistic updates with RTK mutations, example, updating or deleting things? I have read the documentation, but there are no simple examples of how to do it right.
@wishmeheaven9 ай бұрын
A copule of years after this visdo was release so I hope the questions are legit, But before - Thank you for another enriching video! - Does anything change in the last couple of years regarding the pros and cons of Saga and Toolkit? - When would you recommend more for async api integration in a full stack app - Saga or Thunk ?
@lucasduarte7558 Жыл бұрын
I like so much yours explanations! Your nature windows are amazing 😍
@akashshrestha013 жыл бұрын
More videos on RTK plz
@alejomakevids3 жыл бұрын
Darn, generator functions. Never got a grasp of them may be time to learn about it.
@bysolly3 жыл бұрын
Loved it. ❤Redux Toolkit Query vs React Query ⚛
@cdoremus3 жыл бұрын
Nice job! Can you elaborate on what use cases would require redux-sagas? They are way too much cognitive load for my nervous system to use efficiently.
@jherr3 жыл бұрын
Something that would have a lot of choreography between asynchronous events. Maybe a UI that's working with a bunch of microservices directly and needing to make complex sequences of calls.
@szymon88773 жыл бұрын
redux saga is also very straight forward when it comes to testing
@RajeshSoni-b8u Жыл бұрын
Nice Video.. Which VSCode extension was being used for react code completion or snippets?
@arealisticdreamer2 жыл бұрын
Great video. What extension did you use to have these code suggestion?
@jherr2 жыл бұрын
GitHub Copilot.
@mani85863 жыл бұрын
Very good session... thanks Jack 👍
@jr-hp7er3 жыл бұрын
Amazing, was waiting for this :)
@piyushaggarwal52072 жыл бұрын
you are simply jherr
@ahmedChebilahmed19chebil2 жыл бұрын
currently i m using a combination between redux-saga and redux-toolkit
@wishmeheaven9 ай бұрын
Thanks for the representation, although... If those are like apples and oranges - why not include an example of how to use them together..?
@piyushaggarwal52072 жыл бұрын
But can we try to use both at the same time somehow? I don't think its possible. Just asking if there is some way to do that.
@AndyHoebeke2 жыл бұрын
I don't find much content about using RTK Query together with Sagas. Sagas call APIs... so.. they could benefit from RTK Query's caching mechanisms and other features... or not? It works, but does not seem so clean to use RTK query inside Sagas ?
@anishbishnoi29xD Жыл бұрын
Which one should we use rtk redux toolkit or redux saga ?
@AndyHoebeke Жыл бұрын
@AnishKumar-qe4cc Redux Toolkit (RTK) is great. It's a way of using redux with less boilerplate and less chance of bugs 🐛 RTK Query can be used whether you use RTK or not. At work Sagas are used a lot but increasingly we use RTK Query for new parts of the code. You can do a lot with it. The main use case that we still would use Sagas for is when you have requests for many items, some of which may already have been fetched before, and you want to skip fetching them while still including them in the final response. And, when you have several actions triggered by an API query, which can trigger their own API queries.
@anishbishnoi29xD Жыл бұрын
@@AndyHoebekenice, thank you so much. ❤️
@thehaptiK2 жыл бұрын
very helpful. thanks, Jack!
@xtinctspecies3 жыл бұрын
Just shows how awesome life is when using Graphql and Apollo client
@navneetkumarsharma909211 ай бұрын
Hi jack, I guess you should update this to use redux toolkit with redux saga
@saviorhavely Жыл бұрын
Very good, thanks for sharing
@yasser.dev7 Жыл бұрын
Great content as usual thank you!
@ProgrammingWithOsku2 жыл бұрын
I like when you do this , heey its work hahah
@andyfifedenim2 жыл бұрын
I would love for you to do a video on react with variants.. ie a shopping cart with item options…
@sunstrike89433 жыл бұрын
which extension you are using sir ?
@jherr3 жыл бұрын
GitHub Copilot.
@imchiennb3 жыл бұрын
That content is awesome, wish you have stronger to make more videos!
@jherr3 жыл бұрын
Yes!
@ayoubbougroune40502 жыл бұрын
Thanks for sharing
@wasaviAr2 жыл бұрын
Great video!
@gandalfgrey912 жыл бұрын
It seems that every time you say "HeyHeyyy!!" I spend two hours working out a bug.
@archmad2 жыл бұрын
the boilerplate for redux is killing me
@omdxp2 жыл бұрын
How does RTK Query create those custom hooks? Anyone ?
@ProgrammingWithOsku2 жыл бұрын
This is called functional programming
@omdxp2 жыл бұрын
@@ProgrammingWithOsku I know what functional programming is and it's my preferred way to write code. However, my question concerns about the details on how RTK create those hooks on the fly (when you type your code even)
@ProgrammingWithOsku2 жыл бұрын
@@omdxp Do you speak Arabic?
@omdxp2 жыл бұрын
@@ProgrammingWithOsku yes
@ProgrammingWithOsku2 жыл бұрын
@@omdxp كرر سؤالك بالعربي
@joshuamamroud48212 жыл бұрын
I feel like the content is great but FWIW it's hard to follow when you go that fast. Half the time the code you add just appears (I'm assuming it's a combination of copy/pasting & video editing) then you move on to the next step. Maybe you can find a way to slow it down and show where the code is coming from rather than having it just appear? No one else seems to have made this comment so it may just be me. Great content though!
@jherr2 жыл бұрын
I've heard that in the past. And the style tends to vary from video to video. Anything with Redux is probably going to be a little more copy-n-pasty though because of the sheer bulk of code and people not wanting to see my poorly type it out.
@CameronRounder3 жыл бұрын
We just set up redux in one our apps where I work and we went with was using connect API over useSelector because of how useSelector re-renders anything connect to the store on any action, not just actions that update the specific state the component is watching. Does RTQ fix this issue, or does it still re-render everything on all actions?
@jherr3 жыл бұрын
Pull down the code and have a look. :)
@damanpreetgrewal2 жыл бұрын
You can create a memoized selector using createSelector and pass it to your getSelectors() declerations
@andrejjovanovic3695 Жыл бұрын
gj recommend
@dars18163 жыл бұрын
I like the style of Redux Saga more, but that's just imo
@jherr3 жыл бұрын
It got me back into generators. Which has been fun. I think most folks have forgotten about them.