We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 83802c8 commit c49afb4Copy full SHA for c49afb4
Sections/Section 14/01-starting-project/src/App.js
@@ -21,10 +21,9 @@ function App() {
21
22
const [movies, setMovies] = useState([])
23
24
- function fetchMoviesHandler() {
25
- fetch('https://swapi.py4e.com/api/films').then(response => {
26
- return response.json();
27
- }).then(data => {
+ async function fetchMoviesHandler() {
+ const response = await fetch('https://swapi.py4e.com/api/films')
+ const data = await response.json();
28
const transformedMovies = data.results.map(movieData => {
29
return {
30
id: movieData.episode_id,
@@ -34,7 +33,6 @@ function App() {
34
33
}
35
})
36
setMovies(transformedMovies)
37
- })
38
39
40
return (
0 commit comments