import React from 'react'; export default class Channels extends React.Component { constructor(props) { super(props) this.state = { channels: [], } } componentDidMount() { this.getChannels() } getChannels() { fetch('/channels').then(r => r.json()).then(body => { const { channels } = body.response this.setState({ channels }) }) } render() { const { channels } = this.state return ( ) } }