T
TanStack3y ago
equal-aqua

run some stateful code before each query and mutation

Hi i want to run some stateful code(check if my authToken has expired and use a method returned by my useContext(authContext) if it has) before each query and mutation. What would be the recommended way to do it? Any prop from QueryClienyProvider where i could place such logic?
1 Reply
gradual-turquoise
gradual-turquoise3y ago
Wrapping your queries and mutations in custom hooks is probably the way to go. If you can provide some samples of your current code as well as the stateful code you need to run, that'll help us understand more.

Did you find this page helpful?