Socket
Socket
Sign inDemoInstall

@aspida/react-query

Package Overview
Dependencies
24
Maintainers
3
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.12.0 to 1.13.0

dist/cjs/index.d.ts

19

package.json
{
"name": "@aspida/react-query",
"version": "1.12.0",
"version": "1.13.0",
"description": "React Query wrapper for aspida",
"author": "Solufa <solufa2020@gmail.com>",
"license": "MIT",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"bin": "./bin/index.js",
"exports": {
".": {
"require": "./dist/cjs/index.js",
"import": "./dist/esm/index.js",
"types": "./dist/esm/index.d.ts"
},
"./package.json": "./package.json"
},
"homepage": "https://github.com/aspida/aspida/tree/master/packages/aspida-react-query#readme",

@@ -29,4 +38,4 @@ "repository": {

"dependencies": {
"aspida": "^1.12.0"
"aspida": "^1.13.0"
}
}
}

@@ -12,8 +12,2 @@ # @aspida/react-query

</a>
<a href="https://github.com/aspida/aspida/actions?query=workflow%3A%22Node.js+CI%22">
<img src="https://github.com/aspida/aspida/workflows/Node.js%20CI/badge.svg?branch=master" alt="Node.js CI" />
</a>
<a href="https://lgtm.com/projects/g/aspida/aspida/context:javascript">
<img src="https://img.shields.io/lgtm/grade/javascript/g/aspida/aspida.svg" alt="Language grade: JavaScript" />
</a>
</div>

@@ -50,9 +44,9 @@ <br />

```tsx
import { useQueryClient, useMutation, QueryClient, QueryClientProvider } from "react-query"
import { useAspidaQuery } from "@aspida/react-query"
import aspida from "@aspida/axios" // "@aspida/fetch", "@aspida/node-fetch"
import api from "../api/$api"
import aspida from "@aspida/axios"; // "@aspida/fetch", "@aspida/node-fetch"
import { useAspidaQuery } from "@aspida/react-query";
import { QueryClient, QueryClientProvider, useMutation, useQueryClient } from "react-query";
import api from "../api/$api";
const client = api(aspida())
const queryClient = new QueryClient()
const client = api(aspida());
const queryClient = new QueryClient();

@@ -65,7 +59,7 @@ function App() {

</QueryClientProvider>
)
);
}
function postTodo(body: { id: number; title: string }) {
return client.todos.$post({ body })
return client.todos.$post({ body });
}

@@ -75,6 +69,6 @@

// Access the client
const queryClient = useQueryClient()
const queryClient = useQueryClient();
// Queries
const query = useAspidaQuery(client.todos, { query: { limit: 10 } })
const query = useAspidaQuery(client.todos, { query: { limit: 10 } });

@@ -85,5 +79,5 @@ // Mutations

// Invalidate and refetch
queryClient.invalidateQueries(client.todos.$path({ query: { limit: 10 } }))
}
})
queryClient.invalidateQueries(client.todos.$path({ query: { limit: 10 } }));
},
});

@@ -102,4 +96,4 @@ return (

id: Date.now(),
title: "Do Laundry"
})
title: "Do Laundry",
});
}}

@@ -110,6 +104,6 @@ >

</div>
)
);
}
render(<App />, document.getElementById("root"))
render(<App />, document.getElementById("root"));
```

@@ -122,9 +116,9 @@

```tsx
import { useMutation, QueryClient, QueryClientProvider } from "react-query"
import { useAspidaQuery } from "@aspida/react-query"
import aspida from "@aspida/axios" // "@aspida/fetch", "@aspida/node-fetch"
import api from "../api/$api"
import aspida from "@aspida/axios"; // "@aspida/fetch", "@aspida/node-fetch"
import { useAspidaQuery } from "@aspida/react-query";
import { QueryClient, QueryClientProvider } from "react-query";
import api from "../api/$api";
const client = api(aspida())
const queryClient = new QueryClient()
const client = api(aspida());
const queryClient = new QueryClient();

@@ -136,3 +130,3 @@ function App() {

</QueryClientProvider>
)
);
}

@@ -142,7 +136,7 @@

const { data, error } = useAspidaQuery(client.user._userId(123), "get", {
query: { name: "mario" }
})
query: { name: "mario" },
});
if (error) return <div>failed to load</div>
if (!data) return <div>loading...</div>
if (error) return <div>failed to load</div>;
if (!data) return <div>loading...</div>;
return (

@@ -154,6 +148,6 @@ <>

</>
)
);
}
render(<App />, document.getElementById("root"))
render(<App />, document.getElementById("root"));
```

@@ -168,9 +162,9 @@

```tsx
import { useMutation, QueryClient, QueryClientProvider } from "react-query"
import { useAspidaQuery } from "@aspida/react-query"
import aspida from "@aspida/axios" // "@aspida/fetch", "@aspida/node-fetch"
import api from "../api/$api"
import aspida from "@aspida/axios"; // "@aspida/fetch", "@aspida/node-fetch"
import { useAspidaQuery } from "@aspida/react-query";
import { QueryClient, QueryClientProvider } from "react-query";
import api from "../api/$api";
const client = api(aspida())
const queryClient = new QueryClient()
const client = api(aspida());
const queryClient = new QueryClient();

@@ -182,3 +176,3 @@ function App() {

</QueryClientProvider>
)
);
}

@@ -190,10 +184,10 @@

refetchOnMount: true,
initialData: { name: "anonymous" }
})
initialData: { name: "anonymous" },
});
if (error) return <div>failed to load</div>
return <div>hello {data.name}!</div>
if (error) return <div>failed to load</div>;
return <div>hello {data.name}!</div>;
}
render(<App />, document.getElementById("root"))
render(<App />, document.getElementById("root"));
```

@@ -200,0 +194,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc