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