Project structure suggestions #3017
Unanswered
aryaniyaps
asked this question in
Q&A
Replies: 1 comment 1 reply
-
We have a Example:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I would like to create custom hooks for queries and mutations in my project, but I'm not sure where to place them. I'm sure that react-query is being used on large scale projects a lot, so this question might have been already solved. Heres what I went through:
I could store my custom hooks into the hooks directory, but I usually use that to store utilities like stuff for resizing windows. So I'm not sure if data fetching hooks go there.
I dont want to define hooks right above the components they are being used with, because hooks maybe used more than once, and this would cause a mess. Hence I think each hook deserves it's own file.
What seems logical to me is to put queries in a
src/queries
folder, and mutations in asrc/mutations
folder.This is what I would do if I'm using apollo + graphql, I think.
How do you structure react query hooks in your projects? I would like to know about it! Any suggestions for where I could put them?
Beta Was this translation helpful? Give feedback.
All reactions