RTK Query in React-Redux Application: Understanding it for handling HTTP calls and perform Query and Mutation
RTK Query is a powerful data fetching and caching tool built provided in Redux Toolkit . It eliminates the need to manually write thunks middlewares or any other middlewares like SAGA, as well as eliminated need for creating reducers, and selectors for server-side data. In this article, I walk through an example that reads and writes Category data from a REST API step by step. API Base URL used for this demo: https://myserver.dataservices.net/api/CategoryRead, for Read Operations and https://myserver.dataservices.net/api/CategoryWrite Operations The Schema for Category Data Returned is as follows: { "Records": [ { "CategoryRecordId": 84, "CategoryId": "", "CategoryName": "", "BasePrice": 0, "Products": null }, ....... ], "StatusCode": 200, "Message": "Categories are read successfully" ...