Skip to content

Instantly share code, notes, and snippets.

@devbkhadka
Last active April 12, 2020 08:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save devbkhadka/3411f97fd878c8d445359629534c1acb to your computer and use it in GitHub Desktop.
Save devbkhadka/3411f97fd878c8d445359629534c1acb to your computer and use it in GitHub Desktop.
Jest Tutorial
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