0

I want to know how we can use context API for multiple contexts from a class component. In single use, we simply do,

  class ContextConsumer extends Component { 
      static contextType = MyContext;

      componentDidMount() {
          console.log(this.context);
      }
   }

Note: I know how multiple contexts can be used in a functional component. But want to know using in a class component.

Bumuthu Dilshan
  • 430
  • 5
  • 14

0 Answers0