Created
June 11, 2020 14:46
-
-
Save azamsharp/41cd85df378af7fa69ab0e1e81d6515f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useEffect } from 'react'; | |
import './App.css'; | |
import MovieList from './components/MovieList'; | |
function App() { | |
const [movies, setMovies] = useState([]) | |
useEffect(() => { | |
// fetch the movies | |
fetch('http://localhost:3001/movies') | |
.then(response => response.json()) | |
.then(result => { | |
setMovies(result) | |
}) | |
}) | |
return ( | |
<div> | |
<MovieList movies = {movies} /> | |
</div> | |
) | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment