TanStackT
TanStack2mo ago
10 replies
still-lime

recommended pattern to work with

hi, i love this library but there is one catch with it and is when adding a new service/endpoint requests, it feels kinda a slow process (at least the way im doing it) which is the following

add a new directory in the api folder with the endpoint name

make an index.ts file with the querykeys for that service

make a get.ts, post.ts, patch.ts, delete.ts for the main requests (this is mainly because i need to have different types for the responses, even if sometimes is the same entity, because some of them have different fields yada yada

putting the queries in a context provider file so i can have access to them

but all of these feel numbing and dumb and too complex for the sake of it, but i cant really come up with something that is quite right, i think i can omit the step of using the context but idk hjadsfjhdsaj i think i might ended up making a whole mess for nothing

if someone wanna share a project like a midsize or whatever i would be really really grateful
Was this page helpful?