Looks like thunk and saga are 2 types of middleware to allow side effects and asyncronous actions in Redux Toolkit. Based on some basic googling, looks like thunk and saga basically serve the same purpose. Without understanding the key differences between the 2 types of middleware and based on some basic googling, I get the impression that historically, thunk has generally been preferred for small to medium size apps whereas saga has generally been preferred for larger apps.
However, Redux Toolkit has included thunk as default middleware for its slice implementation. So it seems like the Redux Toolkit dev team has decided that thunk is a better choice than saga. Am I inferring this rationale correctly? Can you think of a scenario where saga would be a better choice than thunk for a Redux Toolkit implementation (outside of bias based on the level of developer experience with sagas in particular)? Or does the inclusion of thunk as the default indicate that the Redux Toolkit dev team has chosen thunk as the winner between those 2 middleware technologies?
Looks like createAsyncThunk is the main function used with thunks and it's generally used in regards to supporting api integration. Taking a step back, the general purpose of thunk is to "allow side effects and asyncronous actions" but in reality, is the vast majority of thunk implementations in production apps used to specifically support api integration? For example, if I stated in an interview that I had only used thunks for api integration then would that be a reasonable statement if that's the 90%+ use case for thunk usage? Or are there any specific scenarios where you've used thunks in the past which were not specifically for api integration but represent an important use case scenario that you think developers should understand?
Finally, looks like the Redux Toolkit dev team recommends RTK Query for API integration as opposed to thunks these days. So what would you see as the main scenarios, if any, where using thunks would be the recommended approach in a new Redux Toolkit implementation?