import React from 'react'; import {requestTournamentList} from '../api'; export default class TournamentList extends React.Component { constructor(props) { super(props); this.state = { tournaments: [] }; } componentDidMount() { requestTournamentList(this.props.type, tournaments => { this.setState({ tournaments: tournaments }); }, () => {}); } render() { if (this.state.tournaments.length === 0) { return

keine Turniere vorhanden

; } else { return this.state.tournaments.map(item => ( //The code should be item.code but the api just supports it this way by now )); } } } function TournamentListEntry(props) { return ( {props.name} ); }