React: Suggestion: Support consuming multiple Contexts in Class.contextType

Created on 5 Jan 2019  路  3Comments  路  Source: facebook/react

class App extends React.Component {
  static contextType = [themeContext, userContext]

  render() {
    const [theme, user] = this.context

    /* ... */
  }
}

Most helpful comment

Whys is this closed? I have a use case like this.
Can anyone please suggest a solution if it exists.

All 3 comments

+1 :+1:

Whys is this closed? I have a use case like this.
Can anyone please suggest a solution if it exists.

I need it too. There are some ways to consume multiple contexts in functional component but not in class component.

Was this page helpful?
0 / 5 - 0 ratings