{"id":32722224,"url":"https://github.com/afeiship/react-query-shortcut","last_synced_at":"2026-05-07T19:08:57.513Z","repository":{"id":57122685,"uuid":"275106202","full_name":"afeiship/react-query-shortcut","owner":"afeiship","description":"A lightweight wrapper for TanStack Query that simplifies API integration with a unified interface.","archived":false,"fork":false,"pushed_at":"2025-06-08T06:03:36.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-02T21:05:20.969Z","etag":null,"topics":["nx","query","react","tanstack"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/afeiship.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-06-26T08:13:48.000Z","updated_at":"2025-06-08T06:03:41.000Z","dependencies_parsed_at":"2025-07-08T08:11:21.449Z","dependency_job_id":"dbdd6418-ad9e-447a-9a88-5b29bfe7c210","html_url":"https://github.com/afeiship/react-query-shortcut","commit_stats":null,"previous_names":["afeiship/next-fetch-with-proxy","afeiship/react-query-shortcut","afeiship/npx-assets"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/afeiship/react-query-shortcut","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Freact-query-shortcut","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Freact-query-shortcut/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Freact-query-shortcut/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Freact-query-shortcut/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/afeiship","download_url":"https://codeload.github.com/afeiship/react-query-shortcut/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afeiship%2Freact-query-shortcut/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31870506,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"online","status_checked_at":"2026-04-16T02:00:06.042Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nx","query","react","tanstack"],"created_at":"2025-11-02T21:02:10.868Z","updated_at":"2026-04-16T03:31:57.716Z","avatar_url":"https://github.com/afeiship.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-query-shortcut\n\u003e A lightweight wrapper for TanStack Query that simplifies API integration with a unified interface.\n\n[![version][version-image]][version-url]\n[![license][license-image]][license-url]\n[![size][size-image]][size-url]\n[![download][download-image]][download-url]\n\n## Installation\n```bash\nyarn add @jswork/react-query-shortcut\n```\n\n## Features\n- 🚀 Simplified API integration with TanStack Query\n- 🎯 String-based query keys for easier management\n- 🔄 Unified interface for queries and mutations\n- 🛠 Built-in utilities for data management\n\n## Basic Setup\n```typescript\nimport { QueryClient } from '@tanstack/react-query';\n\n// Initialize your API endpoints\nnx.$api = {\n  'users/list': () =\u003e fetch('/api/users').then(res =\u003e res.json()),\n  'users/create': (data) =\u003e fetch('/api/users', {\n    method: 'POST',\n    body: JSON.stringify(data)\n  }).then(res =\u003e res.json())\n};\n\n// Set up QueryClient\nconst queryClient = new QueryClient();\nnx.$client = queryClient;\n```\n\n## Usage\n\n**useQuery**\n\nSimplified query hook for fetching data:\n\n```typescript\nconst { data, isLoading } = nx.useQuery('users/list');\n\n// Using object config\nconst { data, isLoading } = nx.useQuery({\n  queryKey: ['custom-key'],\n  queryFn: () =\u003e fetchCustomData()\n});\n```\n\n**useMutation**\n\nStreamlined mutation hook for data updates:\n\n```typescript\nconst { mutate } = nx.useMutation('users/create');\n\n// Handle user creation\nconst handleCreate = () =\u003e {\n  mutate({ name: 'John Doe' });\n};\n\n// Using object config\nconst { mutate } = nx.useMutation({\n  mutationFn: (data) =\u003e updateCustomData(data)\n});\n```\n\n**getQueryData**\n\nRetrieve cached query data:\n\n```typescript\n// Get data with string key\nconst userData = nx.getQueryData('users/list');\n\n// Get data with array key\nconst nestedData = nx.getQueryData(['parent', 'child']);\n```\n\n**invalidateQuery**\n\nInvalidate and refetch queries:\n\n```typescript\n// Invalidate with string key\nawait nx.invalidateQuery('users/list');\n\n// Invalidate with array key\nawait nx.invalidateQuery(['parent', 'child']);\n```\n\n## License\nCode released under [the MIT license](https://github.com/afeiship/react-query-shortcut/blob/master/LICENSE.txt).\n\n[version-image]: https://img.shields.io/npm/v/@jswork/react-query-shortcut\n[version-url]: https://npmjs.org/package/@jswork/react-query-shortcut\n\n[license-image]: https://img.shields.io/npm/l/@jswork/react-query-shortcut\n[license-url]: https://github.com/afeiship/react-query-shortcut/blob/master/LICENSE.txt\n\n[size-image]: https://img.shields.io/bundlephobia/minzip/@jswork/react-query-shortcut\n[size-url]: https://github.com/afeiship/react-query-shortcut/blob/master/dist/react-query-shortcut.min.js\n\n[download-image]: https://img.shields.io/npm/dm/@jswork/react-query-shortcut\n[download-url]: https://www.npmjs.com/package/@jswork/react-query-shortcut\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafeiship%2Freact-query-shortcut","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fafeiship%2Freact-query-shortcut","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafeiship%2Freact-query-shortcut/lists"}