Skip to content

Instantly share code, notes, and snippets.

@olajohn-ajiboye
Created July 4, 2019 15:27
Show Gist options
  • Save olajohn-ajiboye/6473af3f67c3d3000fe70b5f2cbd6663 to your computer and use it in GitHub Desktop.
Save olajohn-ajiboye/6473af3f67c3d3000fe70b5f2cbd6663 to your computer and use it in GitHub Desktop.
import React, { useContext } from 'react'
import Recipe from './Recipe'
import RecipeSearch from './RecipeSearch'
import { RecipeContext } from '../context/index'
export default function RecipeList() {
const appContext = useContext(RecipeContext)
const { showHomeButton, recipes, handleReturnHome } = appContext
return (
<>
<RecipeSearch></RecipeSearch>
<div className="container my-5 home-button">
{showHomeButton && <button type="button"
className="btn btn-warning"
onClick={() => handleReturnHome()}>
Go Back Home
 </button>}
<div className=" d-flex d-flex justify-content-center mb-3">
<h1 className="text-slaned ">Recipe List</h1>
</div>
<div className="row recipe-list">
{recipes.map(recipe => {
return <Recipe
key={recipe.recipe_id} recipe={recipe} />
})}
</div>
</div>
</>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment