Skip to content

I can't seem to fully understand React-Redux... #139778

Discussion options

You must be logged in to vote

Hi @MarshallNickolauson

1. createAsyncThunk:

  • Purpose: This is designed for handling asynchronous logic (like API calls) in a simple way. It’s great when you have a few API calls to make, or you want more control over how to handle the API response (e.g., additional side effects).
  • Setup: You use createAsyncThunk inside your slice, and you can handle success, error, or loading states in your reducers.
  • Flexibility: It gives you full control over each step of the API request and state management, but this also means more boilerplate.

2. createApi:

  • Purpose: createApi from @reduxjs/toolkit/query is more specialized for managing multiple API calls and handling CRUD operations. It automaticall…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@MarshallNickolauson
Comment options

@ferid333
Comment options

Answer selected by MarshallNickolauson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Programming Help Programming languages, open source, and software development.
2 participants