How To Use Redux Toolkit Query along with Axios in React application (RTK + Axios)

preview_player
Показать описание
In this short tutorial I show you that how you can use Redux toolkit query along with axios. We will create a BaseQuery which will be based on axios service and we will create an API with createApi from Redux toolkit. We will fetch data from a live endpoint. The Redux reducer will be generated automatically and we will use it in the Redux store.

00:00 - Intro
00:59 - Overview
02:49 - Creating the Axios instance and defining types
04:38 - Creating the BaseQuery for RTK query
06:32 - Creating the API with createApi function
10:16 - Creating the Redux store
12:35 - Using the Redux store
13:15 - Using the RTK query hook inside our component (fetching data, render)

#react #redux #rtk #redux-toolkit #reduxtoolkit #axios

------------------------------
My name is László Leber
Рекомендации по теме
Комментарии
Автор

Great video. I was using rtkquery for POST requests and the server wasn't able to receive the data in the body. But when I tested using axios, things were working fine. So I resorted to using the solution you provided in this video. Thank you so much. You saved me a lot of time.

the_benjamin_k
Автор

@Aravind Kumar Marri, somehow youtube deleted your comment, but I can answer here: The next video will be about service meshes, and I will show there that how you can use the rtk query + axios based services inside Unit tests. We will use mock server for the application and for the unit test as well.

codeching
visit shbcf.ru