Last active
April 12, 2020 08:03
-
-
Save devbkhadka/3411f97fd878c8d445359629534c1acb to your computer and use it in GitHub Desktop.
Jest Tutorial
This file contains 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, { useEffect, useState } from 'react'; | |
import './App.css'; | |
import { fetchRestaurants } from './utils'; | |
import Restaurants from './Restaurants'; | |
function App() { | |
const [restaurants, setRestaurants] = useState(null) | |
useEffect(()=>{ | |
fetchRestaurants() | |
.then(setRestaurants) | |
.catch(()=>console.log("error in fetching")) | |
}, []) | |
return ( | |
<Restaurants list={restaurants}/> | |
); | |
} | |
export default App; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment