Cloud Stack Ninja

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

        <div className="app">
                <Header />
                    <Route path="/CodeSystem" component={PageCodeSystem} />
                    <Route path="/ValueSet" component={PageValueSet} />
                    <Route path="/RefSets" component={PageRefSets} />
                    <Route path="/" exact component={HomePage} />

Further down the component tree I have a composed that uses its own context shared with its children components.

            <ValueSetSidebar />
            <ValueSetBody />

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.


Read more here:

Content Attribution

This content was originally published by BENBUN Coder at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: