Access context inside queryFn
#4667
-
Currently I am using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Not sure I fully follow the use-case. If something is only available as a hook, like |
Beta Was this translation helpful? Give feedback.
Not sure I fully follow the use-case. If something is only available as a hook, like
useAuth
, and you want to access that in a react-router loader - you have to pass it in there. Though I am questioning the need of having a token refresh logic live inside react. As you said, you mostly need this outside of react (in the queryFn). Usually, the best place to do these kind of things is in your "network layer", like the fetch wrapper you're likely to have. There, you also don't have or need react.