import React, { Component } from 'react'; import ChannelService from '../../services/chanel'; import './ChannelList.scss'; export default class Channellist extends Component { service: ChannelService; constructor(props: any) { super(props); this.state = { loaded: false, channels: [], }; this.service = new ChannelService(); } componentDidMount() { fetch('http://haveachin.de:1888/v1/channels') .then(res => res.json()) .then(data => this.setState({ channels: data, loaded: true })) .catch(e => console.log(e)); } public render() { const { loaded, channels } = this.state; console.log(this.state); if (!loaded) { return
Loading...
; } else { return ( ); } } }