Grokking React Native
0% completed
Handling Async Data Fetching with createAsyncThunk
How do you store data that arrives a second after you ask for it? A reducer cannot do the waiting, because it must return the next state immediately and must not make network requests. The request has to run outside the reducer and then report what happened through actions.
Redux Toolkit provides createAsyncThunk for this. A thunk is a function that you pass to dispatch instead of an action, and it can do asynchronous work and dispatch actions when it is ready. createAsyncThunk builds a thunk from your request function
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%