is there a better way to do this?
so i have a component that renders a post list according to varying api calls
however, this requires the two
ts-ignore
at the bottom.
is there a way to tell ts that the two api calls result in the exact same type?1 Reply
your implementation is against the laws of hooks. Hooks should not be called conditionally. Instead, you can make use of the
enabled
option of react query.
I think this is the good way of doing what you want.
If you want to use only one variable for any of the data you can do this:
This issue is more of react-query
related rather than trpc
.