tsviewer-frontend/src/components/channels/Channellist.tsx

20 lines
463 B
TypeScript

import React, { Component } from 'react';
export default class Channellist extends Component<any, any> {
constructor(props: any) {
super(props);
this.state = {
data: 'Loading...',
};
}
componentDidMount() {
fetch('https://ts.cliffbreak.de/v1/channels')
.then(response => response.json())
.then(data => this.setState({ data }));
}
public render() {
const { data } = this.state;
return <div>{data}</div>;
}
}