t
tRPC
t
tRPC
Fetching data inside other (non-tRPC) hooks
Original message was deleted
tRPC
Join
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,111
Members
View on Discord
N
Nick
•
2/8/23, 1:11 PM
This is totally valid if that
's what you mean
?
function useMapEvents() { const result = useQuery(...) ... }
function useMapEvents() { const result = useQuery(...) ... }
N
Nick
•
2/8/23, 1:29 PM
This is a react fundamental thing
, so it
's worth having a look at their docs on the rules of hooks
N
Nick
•
2/8/23, 1:29 PM
custom hooks are definitely allowed but there are some conventions to follow
function
useMapEvents
() {
const
result
=
useQuery
(
...
)
...
}
function
useMapEvents
() {
const
result
=
useQuery
(
...
)
...
}