I am trying to set an array by reading json information from a get request. Below I hardcoded it to test and it seems to print the list in the drop-down button. But in my fetch json request It doesn't seem to work if I print from teamsList, if I print from teams(hardcoded) it works.
Here is my console output, I also noticed they look a little different on the first line even though they are both the same exact array. Is something wrong here?
let teamsList = []
    fetch(`/api/teams`)
        .then(res => res.json())
        .then(responseJSON => {
          responseJSON.map(cls => (
            teamsList.push(cls.name)
          ))
        })
    let test = ['Chaos', 'High Elves', 'Orcs']
    console.log(teamsList)
    console.log(test)
    // doesnt work
    return (
      <DropdownButton id="dropdown-team-button" title={this.props.team_name}>
          {teamsList.map(cls => (
              <div key={cls}>
                  <Dropdown.Item onClick={this.handleTeamSelection} title={cls}>{cls}</Dropdown.Item>
              </div>
          ))}
      </DropdownButton>
    )
    // works
    return (
      <DropdownButton id="dropdown-team-button" title={this.props.team_name}>
          {test.map(cls => (
              <div key={cls}>
                  <Dropdown.Item onClick={this.handleTeamSelection} title={cls}>{cls}</Dropdown.Item>
              </div>
          ))}
      </DropdownButton>
    )

