cvara / rxdb-hooks

React hooks for integrating with RxDB
MIT License
132 stars 5 forks source link

How to combine multiple collection queries into a single hook? #82

Open NorthMcCormick opened 10 months ago

NorthMcCormick commented 10 months ago

HI All,

This might be more of a react question and not as related to the hooks, I'm just struggling to understand how I can combine multiple collection queries into a single hook result that gets updated if the data in one query changes in the database?

I want to re-use the logic provided in these hooks because it is so robust, and gather data from two queries to construct data for my UI in a single hook that can be placed in my components.

I've been poking my way through trying to create a custom hook that implements multiple of these but I'm not having much luck.

Would anyone happen to have any sample code or insight into how I can achieve this using these hooks without having to reimplement all the 'isFetching' and observables?

Is useMemo what I should be looking at?

Any insight is greatly appreciated