Problem Statement
What is createAsyncThunk and how does it simplify async logic in RTK?
Explanation
createAsyncThunk is an RTK function that generates thunks for async operations, automatically dispatching pending, fulfilled, and rejected actions based on the promise returned by your async function. It simplifies async logic by eliminating the need to manually create three action types and three action creators for each async operation, handles promise lifecycle automatically, and provides consistent patterns for loading states and error handling. You define the async function and then handle the generated actions in extraReducers to update state accordingly, making async code more maintainable and reducing boilerplate significantly.
