
Frontend @spotdrafthq, experienced in both react and angular.
Bengaluru
Joined November 2022
- Tweets55
- Following117
- Followers15
- Likes92
Pinned Tweet
Here's a custom query hook generator I wrote using
@clerk auth with @tan_stack query to make authenticated requests to your custom backend. It lets you pass in a @zodtypes schema to type-check the api response and you also get great autocomplete when using the query
Just registered for JetBrains #JavaScriptDay2025. Join me on Oct 2! lp.jetbrains.com/javascript-…
1
1
79
Ayush Seth retweeted
Replying to @thdxr
I think you should be able to articulate a meaningful way your solution could be better than an alternative before going too deep on a project
Ayush Seth retweeted
Replying to @Julien_Delort
you can do that in the global handler, too. It has access to `data` from the query, and the whole query itself, so the `meta` field is pretty powerful here:
teapawt.org/TkDodo/status/16474930…
Replying to @songil
you can use your useVouchers() hook multiple times, in different components though ?
One trick is to set the `meta` field to contain the message that you want, and let the global handler pick that up:
![const queryClient = new QueryClient({ queryCache: new QueryCache({ onSuccess: (data, query) => { if (query.meta.message) { showSuccessToast(query.meta.message) } } }) }) export function useVouchers() { return useQuery({ queryKey: ['vouchers'], queryFn: fetchVouchers, meta: { message: 'Successfully fetched vouchers', }, }); }](https://pbs.twimg.com/media/Ft0R-nIWAAEbPUK.jpg?name=small&format=webp)
ALT const queryClient = new QueryClient({ queryCache: new QueryCache({ onSuccess: (data, query) => { if (query.meta.message) { showSuccessToast(query.meta.message) } } }) }) export function useVouchers() { return useQuery({ queryKey: ['vouchers'], queryFn: fetchVouchers, meta: { message: 'Successfully fetched vouchers', }, }); }
You can use it like any other query hook with all the types being inferred correctly from the zod schema you provided
1
2
233
Here is the source code for the generator function
gist.github.com/ayush-seth/7…
6
230
I just watched the demo for @clerk and it blew my mind! It is literally "drop-in" authentication for your react apps.
Just published the solution for day 2 of Advent of Code. Day 2's problem is a good excercise to learn how you can reduce cyclomatic complexity in your code using dictionaries in a smart way.
#AdventOfCode #AdventOfCode2022 #AdventCalendar
github.com/ayush-seth/aoc-20…
Ayush Seth retweeted
80% programmers use VS Code.
But their Productivity Suck.
Here are the top 8 VS code extensions to take your productivity to next level.
A Thread🧵👇
Ayush Seth retweeted
i think neovim builtin lsp + mason.nvim (if you want auto install) is pretty seamless experience. you could checkout github.com/nvim-lua/kickstar… as an example starter config that sets a bunch of this up
Ayush Seth retweeted
"sure an n^2 solution works, but can you come up with something a little faster?"

















