Problems using useQuery inside a Context
This is the context (very simplified):
- I have several tables of related elements, organized in a hierarchical way (see example below)
- I have a navBar on which I can select a Main object from a list. Selecting an Item gives me its ID
- In my main page, I want to display the different components of a Main object (referenced by the previously selected ID),
- therefore, I need to gather this data from the database (ie: the Main object, the Country referenced by the
countryId and the cities references by the cityIds[])Since I will need to use several Components to display everything, I don't want to be passing props all along and need to create a Context that wraps my page, to provide access to all the necessary info in one place.
However, although the mainId wouldn't change, its countryId could change. How would I detect this change in my context and re-query the planet data for the same Main object?
