{"id":26282113,"url":"https://github.com/mazahirharoon/react-query-playground","last_synced_at":"2026-04-27T17:04:17.134Z","repository":{"id":281108941,"uuid":"944231134","full_name":"MazahirHaroon/react-query-playground","owner":"MazahirHaroon","description":"A working example of using React Query to improve fetching/updating data from the Fake REST API (JSONPlaceholder). The purpose of this project is to provide a base setup for experimenting with React Query, including options for caching, stale time, and query invalidation. Designed for anyone looking to quickly set up a React Query Playground.","archived":false,"fork":false,"pushed_at":"2025-03-09T19:24:20.000Z","size":166,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-01T17:58:58.332Z","etag":null,"topics":["react","react-query","reactqueryv5","tanstack-react-query","typescript","vite"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MazahirHaroon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2025-03-07T02:05:30.000Z","updated_at":"2025-03-09T19:24:24.000Z","dependencies_parsed_at":"2025-03-07T03:24:51.108Z","dependency_job_id":"7aa8f444-e162-4e69-944c-88a5ba8e8bb9","html_url":"https://github.com/MazahirHaroon/react-query-playground","commit_stats":null,"previous_names":["mazahirharoon/react-query-playground"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MazahirHaroon/react-query-playground","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MazahirHaroon%2Freact-query-playground","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MazahirHaroon%2Freact-query-playground/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MazahirHaroon%2Freact-query-playground/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MazahirHaroon%2Freact-query-playground/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MazahirHaroon","download_url":"https://codeload.github.com/MazahirHaroon/react-query-playground/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MazahirHaroon%2Freact-query-playground/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32345860,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T23:26:28.701Z","status":"online","status_checked_at":"2026-04-27T02:00:06.769Z","response_time":128,"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":["react","react-query","reactqueryv5","tanstack-react-query","typescript","vite"],"created_at":"2025-03-14T16:39:24.681Z","updated_at":"2026-04-27T17:04:17.102Z","avatar_url":"https://github.com/MazahirHaroon.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Query Playground with JSONPlaceholder API\n\n#### Overview\n\nThis repository serves as a **working example of React Query** fetching data from the **Fake REST API** ([JSONPlaceholder](https://jsonplaceholder.typicode.com/)). The purpose of this project is to provide a **base setup for experimenting with React Query**, including options for caching, stale time, and query invalidation.\n\nIt is designed for **personal reference and for anyone looking to quickly set up a React Query playground**.\n\n---\n\n## Features\n\n- Fetches a list of posts from the [JSONPlaceholder API](https://jsonplaceholder.typicode.com/posts) using React Query, demonstrating efficient data fetching and caching.\n- Adds a new post via the API’s `POST` method. Since the API does not persist new posts, the newly created post is temporarily appended to the list for demonstration purposes.\n  - Showcases how React Query automatically re-fetches data when invalidating the correct `queryKey`, ensuring the latest data is retrieved from the API.\n- Implements **React Query** with various options (caching, refetching, stale time).\n- Uses **React 19** and **Vite**\n- Modular and reusable query setup for easy experimentation.\n\n---\n\n## **Tech Stack**\n\n- **React 19**\n- **React Query**\n- **Vite**\n- **TypeScript**\n\n---\n\n## Screenshots\n\n\u003cimg width=\"1792\" alt=\"image\" src=\"https://github.com/user-attachments/assets/fe1080f6-2827-4ed5-aa3b-20cdf2a0afc0\" /\u003e\n\n\u003cimg width=\"1249\" alt=\"image\" src=\"https://github.com/user-attachments/assets/801bbcb3-dd8d-42b6-92cc-8250c607ce9b\" /\u003e\n\n\n---\n\n## Installation \u0026 Setup\n\n1. **Clone the repository:**\n\n```sh\ngit clone https://github.com/MazahirHaroon/react-query-playground.git\ncd react-query-playground\n```\n\n2.  **Install dependencies:**\n\n```sh\nnpm install\n```\n\n3. **Start the development server:**\n\n```sh\nnpm run dev\n```\n\n1. **View the app at:**\n\n```\nhttp://localhost:5173/\n```\n\n---\n\n### Path Aliases\n\n- `@components`: Components Directory\n- `@api`: API Directory\n- `@interfaces`: TS Interfaces Directory\n- `@constants`: Constants Directory\n\n---\n\n## External Docs\n\n- [React Query Docs](https://tanstack.com/query/latest)\n- [JSONPlaceholder API](https://jsonplaceholder.typicode.com/)\n- [Vite](https://vitejs.dev/)\n\n---\n\n## Folder Structure\n\n```graphql\nreact-query-playground/\n├── src/\n│   ├── App.tsx\n│   ├── index.css\n│   ├── main.tsx\n│   ├── utils.ts\n│   ├── api/\n│   │   └── post.ts\n│   ├── components/\n│   │   ├── index.tsx\n│   │   ├── Form/\n│   │   │   ├── ... Form components\n│   │   ├── Post/\n│   │   │   ├── ... Form components\n│   │   ├── ...Other UI Components\n│   ├── constants/\n│   │   └── post.ts\n│   ├── hooks/\n│   │   └── usePostData.tsx\n│   ├── interfaces/\n│   │   └── post.ts\n│   ├── pages/\n│   │   └── Post/\n│   │       ├── content.tsx\n│   │       ├── index.css\n│   │       ├── index.tsx\n│   │       └── options.tsx\n```\n\n---\n\n### **License**\n\nThis project is licensed under the **MIT License** – feel free to use, modify, and experiment with it.\n\n---\n\n#### **Contributions**\n\nIf you find this useful or want to add improvements, feel free to submit a **PR** or raise an **issue**.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmazahirharoon%2Freact-query-playground","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmazahirharoon%2Freact-query-playground","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmazahirharoon%2Freact-query-playground/lists"}