<file_sep>import React from 'react';
import {Link, Route} from 'react-router-dom';
import Main from './Main';

export default function NotFound() {
  return (
    <div>Oops! That page doesn't exist. Try <Link to='/'>starting here</Link> :) <Route path='/albums' component={Main} /> </div>
  )
}
<file_sep>import React, {Component} from 'react';
import {AllAlbums} from './AllAlbums';
import axios from 'axios';

export default class StatefulAlbums extends Component {
  constructor() {
    super();

    this.state = {
      albums: []
    }
  }

  componentDidMount () {
    axios.get('/api/albums/')
      .then(res => res.data)
      .then(albums => {
        this.setState({ albums })
      })
      .catch(error => this.props.history.push("/NotFound"));
  }

  render() {
    return <AllAlbums albums={this.state.albums} />
  }

}

