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
  • 382
  • 3
  • 13

0 Answers0