I'm a relative newbie with regards to React JS, I am trying to get my use of contexts working.
I have an app, when the entry component (App) is defined with
<Router>
<div className="app">
<GlobalContextProvider>
<Header />
<Switch>
<Route path="/CodeSystem" component={PageCodeSystem} />
<Route path="/ValueSet" component={PageValueSet} />
<Route path="/RefSets" component={PageRefSets} />
<Route path="/" exact component={HomePage} />
</Switch>
</GlobalContextProvider>
</div>
</Router>
Further down the component tree I have a composed that uses its own context shared with its children components.
<QueryVSContextProvider>
<ValueSetSidebar />
<ValueSetBody />
</QueryVSContextProvider>
From the above, within the ValueSetBody component I have:
class ValueSetBody extends Component {
static contextType = QueryVSContext;
render() {
const { bundle } = this.context;
...
}
}
How could I also access the "GlobalContext" which was defined up at the App component? I want to be able to detect changes in the GlobalContext from the class component.
thanks