fetch

Redux Toolkit Tutorial - 30 - Fetching Data

0:00
↔️ ↕️

Timecodes:

welcome back everyone

in this video let's learn how to make

use of the async thunk in the user slice

to fetch and display data in our user

view component

let me begin by quickly recollecting the

code we have written in user slice

first we have the initial state which

contains three properties

loading to indicate if the request is

happening in the background

users to store the array of users

fetched from the api

and error to display an error if there

was any

next we have the async logic written

using the create async thunk function

the first argument is the action type

and the second argument is the async

function which returns a promise

in our case we query jsonplaceholder


Related queries:


how to get data from api in redux
how to fetch data from api using redux toolkit
how to fetch data from api using redux
how to fetch api in redux
how to get data from fetch api
how to fetch an api in javascript
fetch vs get api