@ventlio/tanstack-query 0.2.9 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
-
#
|
|
1
|
+
# This is not a replacement for @tanstack/react-query
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## WHY THIS PACKAGE?
|
|
4
|
+
|
|
5
|
+
We have been working on a project using ReactJS and React-Native and we were happy with the React-Query package, now known as Tanstack-Query, which had made our lives easier by managing most of the state management features needed for enterprise software development. This had helped us focus on building functionalities easily without worrying about server state management.
|
|
6
|
+
|
|
7
|
+
However, we still faced some challenges. For each project, we have to configure how Tanstack-Query would connect to the Backend API and manage GET, POST, PUT, and PATCH requests efficiently. One of the major challenges was handling dynamic queryKeys in Tanstack-Query. For example, when building a screen with pagination, useQuery will have re-call the queryFunction every time the key changed, which will load the current page data. This meant that the queryKey changed dynamically, and sometimes we needed to use the queryKey of the current page to perform certain tasks like updating a specific row in the view. This was always tedious.
|
|
8
|
+
|
|
9
|
+
But we were not discouraged. We knew that every challenge presented an opportunity for growth and development. So, we set out to find a solution. This package would handle dynamic queryKeys in Tanstack-Query and solve other related problems. It made configuring Tanstack-Query to connect to the Backend API and managing GET, POST, PUT, and PATCH requests a breeze. It also solved the problem of dynamic queryKeys, making it much easier to update specific rows in the view.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
> You must install @tanstack/react-query and axios first to use this package
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
npm install @tanstack/react-query axios
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
After that install this package
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
$ npm install @ventlio/tanstack-query
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
$ yarn add @ventlio/tanstack-query
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Getting Started
|
|
32
|
+
|
|
33
|
+
Follow the below instructions to have the package running on your project
|