My problem is that I get a response from the BE but I'm unable to assign it to a variable in the FE. This is my code:
  componentDidMount = async () => {
    try {
      const response = await fetch('http://localhost:8080/classes/all', {
        method: 'GET',
        headers: {
          'Content-Type': 'application/json'
        }
      })
      if(response.ok){
      const classes = await response.json();
        console.log('classes' + classes);
        this.setState({
          classes,
          selectedClass : classes[0],
          selectedSubject : classes[0].subjects[0].name
        });
      }
    } catch (error) {
      this.setState({ error });
      alert(error.stack);
    }
  };
And the network returns an array of 4 classes, so no problem there... I'm wondering what it up with my code?
