@antokhio - thank you for the linked libraries, maybe I can find the solution by studying their code as these libraries (especially use-context-selector) solve exactly the same issue I am confused by right now.