You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Instantly share code, notes, and snippets.
Tim Kindberg
timkindberg
Principle Dev @ Workday. Creator of jest-when. Mentor and Explorer of Front End patterns and practices.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What if we could construct an object that described everything about the fetch and query all together in a single object. And that object could be ultra-portable, able to be passed to any sort of functions such as:
useQuery(<new api object>) - declarative hook-fetched data
fetchQuery(<new api object>) - imperative method-fetched data
prefetchQuery(<new api object>) - imperative method-fetched data for SSR cache
invalidateQuery(<new api object>) - invalidate the api's cache key
mockApiResponse(<new api object>) - mock the api for a test