Untitled

mail@pastecode.io avatar
unknown
javascript
3 years ago
560 B
2
Indexable
Never
import Home from './components/Home/Home';
import Loader from './components/Loader/Loader';
import useResources from './hooks/useResources';

import './App.css';

function App() {
  const { resources, isLoading, isError } = useResources('https://itunes.apple.com/us/rss/topalbums/limit=100/json');

  const feed = resources && resources.feed && resources.feed.entry;

  return (
    <>
      {isError && <p>Something went wrong</p>}
      {isLoading ? (
        <Loader />
      ) : (
        <Home artists={feed} />
      )}
    </>
  )
}

export default App;