Skip to content

Instantly share code, notes, and snippets.

@azamsharp
Created June 11, 2020 14:46
Show Gist options
  • Save azamsharp/41cd85df378af7fa69ab0e1e81d6515f to your computer and use it in GitHub Desktop.
Save azamsharp/41cd85df378af7fa69ab0e1e81d6515f to your computer and use it in GitHub Desktop.
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