Closed ivoilic closed 1 year ago
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
zact-example | ❌ Failed (Inspect) | Apr 13, 2023 3:43am |
👀
Updated the readme with a client example. @t3dotgg, I'd love to help more on this project. I know it's pretty early but let me know if there is anything specific I can do: code, docs, logo etc.
Tried using this in an actual project and realized there were react hook issues that hadn't been caught by eslint. Also added a way to use middleware!
@ivoilic yeah you have to prefix the caller with use for it to work, that's why I went with the useMutation(namedMutation)
pattern. Same reason tRPC mutations in React have to end with useMutation. Also fun fact: many linters only work if the function STARTS with use, i.e. useQuery(trpc) works but
trpc.useQuery()` does not 😅
If we were to pursue something like this, my preferred pattern would be something more like useZact(client.someMutation)
- at which point you can kind of just define an object and be done with it
@t3dotgg Thank you so much for taking the time to check this and out and for the info! Totally understand your preference on this.
Stumbled on this repo and love the concept. Thought it might be nice to have a centralized way to organization/access all your actions rather than having to import both the action and the hook each time. Hope you like it, let me know if you have any thoughts or ideas!