Shared/Common api location ?
ChambreNoire opened this issue · comments
Hello.
Quick question: Where would you put shared react-query wrappers? Say one were to have a modal dialog that is used by multiple features (and therefore lives in /components
) and that is responsible for loading something from a server endpoint...
Cheers
I would put it under /hooks
of the specific feature.
Like @Odas0R said, the /hooks
directory would work.
I put them in a /api
directory to separate api specific hooks from other hooks. Also its adds a bit of consistency, so any react-query wrappers are found in the /api
directory regardless of whether its in a feature or not.
Yeah, I agree, @CodeNameGrant. I guess I may have misunderstood the question since I've been doing exactly how you said for a couple of months 😆.