Blogged Answers: Why Redux Toolkit Uses Thunks for Async Logic · Mark's Dev Blog
DRANK

Reasons why I selected thunks instead of sagas as the default async middlewareI was recently asked if I plan on supporting anything besides thunks for async logic and side effects in Redux Toolkit.At the moment, I only plan on having explicit support for thunks, because:That doesn't mean you can't use other async middleware. configureStore specifically has middleware and enhancer arguments, allowing you to add whatever async middleware you want as part of your store setup, same as the base createStore.FWIW, I've used sagas before and think they're a great power tool for complex async logic. I just don't think they're the right tool to be forcing on folks as a default, and most apps don't need them.Note that the new createAsyncThunk alpha API specifically generates those async lifecycle action types for you. I suppose you could use that with sagas too, by calling it and reusing the exposed action creators / types.I've seen folks argue that sagas are "simpler" than thunks. I agree that …

blog.isquaredsoftware.com
Related Topics: React