title: How to use React Context inside function of Class component
body: <p>How can I access objects inside of React Context inside a function of a Class Component. </p>
  
  <p>I've got the following React Component</p>
  
  <pre><code>import StoreContext from '../../context/StoreContext'
  
  class ProductForm extends Component {
    static contextType = StoreContext
  
    constructor(props) {
      super(props);
  
    }
  
    handleOptionChange(event) {
  
      const test = this.contextType.client.testObject
  
    }
  </code></pre>
  
  <p>I've tried accessing the <code>client</code> object inside the context like this but It doesn't work because it says cant read the property of undefined.</p>
  
  <p>I'm wondering where my mistake is. </p>