Skip to content

Instantly share code, notes, and snippets.

View Cheesetouched's full-sized avatar
🛠️
Learning & Building

Rishabh Singh Cheesetouched

🛠️
Learning & Building
View GitHub Profile
@Cheesetouched
Cheesetouched / useOptimisticUpdate.js
Created September 24, 2023 08:36
Simple hook to perform optimistic updates with react-query
import { useCallback } from "react";
import { useQueryClient } from "@tanstack/react-query";
export default function useOptimisticUpdate() {
const queryClient = useQueryClient();
return useCallback(
async (queryKey, updater) => {
await queryClient.cancelQueries({ queryKey });
@Cheesetouched
Cheesetouched / .gitignore
Created March 3, 2019 04:18
Standardised gitignore for your Flutter apps & Dart projects
### Flutter Generated
# Miscellaneous
*.class
*.lock
*.log
*.pyc
*.swp
.DS_Store
.atom/