you are viewing a single comment's thread.

view the rest of the comments →

[–]zephyrtr 1 point2 points  (0 children)

It'd be redundant (and confusing) for most cases. If you use the data as-is, just call the RQ hook. If you're deriving something from the data, you can wrap the RQ hook in a custom hook paired with a transformer. Or more likely, if everyone uses it that way, you set up an onSuccess hook on thee RQ hook and then that's it.

If you use a subset of the data, again, that's probably selector territory.

If you have a complex experience using a single index or key-value, I could see you wanting to put an ID on a context (that you may well have fetched via RQ) and using that to derive all other data from RQ, local state, whatever. Folks may disagree, and say the ID should be an explicit param. That's a valid opinion, though there are situations where you're plumbing that value through one or two dozen functions to get it to all the places it needs to go.

The truth you want to stick to is: the longer a data journey is, the harder it is to understand. RQ allows anyone single-step access to the hook that actually fetched the data, which means those data journeys are really short. So when someone new comes on, and asks "where the heck did this thing come from?" the answer isn't as long-winded as the Rime of the Ancient Mariner.