import React, { Component } from "react"; import { BrowserRouter as Router, Route, Link } from "react-router-dom"; const axios = require('axios'); class Playlists extends Component { constructor(props){ super(props); this.state = { isLoading: true } this.getPlaylists(); } getPlaylists(){ var self = this; axios.get('/api/playlists') .then((response) => { self.setState({ playlists: response.data.playlists, isLoading: false }); }); } render() { const table =
; const loadingMessage =

loading...

; return this.state.isLoading ? loadingMessage : table; } } function Table(props){ return (
{ props.playlists.map((playlist) => ) }
); } function Row(props){ return ( ); } function PlaylistLink(props){ return ( { props.playlist.name } ); } function getPlaylistLink(playlistName){ return '/app/playlist/' + playlistName; } export default Playlists;