Replies: 2 comments 1 reply
-
The groundwork for this is already being laid. You can see the separation of concerns in the source code with folders like |
Beta Was this translation helpful? Give feedback.
-
Although I am using React, I have a different use case for why I think separating out the core logic would be useful. Often times, there is logic in the query function that I don't want to require each of my components to define. Additionally, the keys and some of the config options I may want to protect. So my solution is to create an interface per entity/domain object for interacting with it that limits this exposure Example:
The problem is that because of React's requirements for hooks being at the top level, there is no way for me to parameterize the |
Beta Was this translation helpful? Give feedback.
-
Hi there! Would be an idea to create a simple framework (or at least hook independent) client for querying, mutating and caching? This would allow the client to also be used outside of a React context, while sharing the same cache, and still provide functionalities like optimistic updates. Like in redux actions or sagas for example. The React components and hooks could then be thin wrappers around this client. As a bonus, the client could even be used in different frameworks, although the library name does have react in it ;) I know the library is already somewhat setup like this with the queryCache, but maybe the API could be a bit more query and mutation oriented and presented as a "client".
Beta Was this translation helpful? Give feedback.
All reactions