Skip to content

Instantly share code, notes, and snippets.

@olajohn-ajiboye
Created June 29, 2019 05:56
Show Gist options
  • Save olajohn-ajiboye/3269b92bc6fce5fcc0cd9f85e45761ce to your computer and use it in GitHub Desktop.
Save olajohn-ajiboye/3269b92bc6fce5fcc0cd9f85e45761ce to your computer and use it in GitHub Desktop.
import React, { useState, useEffect } from 'react';
import RecipeList from './components/RecipeList
function App() {
const url = useState(`https://api.myjson.com/bins/t7szj`)
const [recipes, setRecipes] = useState([])
const fetchRecipe = async () => {
const recipeData = await fetch(url)
const { recipes } = await recipeData.json()
setRecipes(recipes)
}
useEffect(() => {
fetchRecipe()
})
return (
<div className="App">
<RecipeList recipes={recipes}>
</div>
);
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment