Let's Build React Query in 150 Lines of Code!
summary
Claims a miniature React Query rebuilt in 150 lines of code, actually implements a QueryClient, Query objects, a QueryObserver and a useQuery hook wired through context, shows deduping via promise, adds staleTime and cacheTime (default five minutes) with garbage collection, refetch-on-focus and simple devtools. Demo runs end to end and the code sits around ~140 lines, but code is naive, untyped and explicitly not production ready.
AI-written summary · about
chapters (11)
- 0:00Start
- 0:26Tanya Linsley
- 0:55React Query
- 1:26React Query Essentials
- 2:05What Is React Query
- 5:09React Query Examples
- 13:09Query Client
- 15:17Query Observer
- 21:01Cache Time
- 21:56Schedule a Garbage Collection
- 24:11Dev Tools
related talks
25mReact Query Under the Hood
11mSimple data fetching with React Query
20mReact Query API Design – Lessons Learned
30mReact Query API Design: Lessons Learned
41mReact Query: The Next Big Library?
29mReact Query: It’s Time to Break up with your "Global State"!
21mData Fetching with React Query A Crash Course
26mData Fetching Unleashed: Next.js, React Query and their BFF
