| Level Navigation: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19⚡ | 20 |
Goal: Create the main PotluckMeals component and import it into your App component.
User Story: As a developer, I want to create a component that can fetch and display data from my database so that I can see my potluck meals.
Create the PotluckMeals component with basic structure and import it into your App component.
src/components/PotluckMeals.jsx with basic structureuseState from React../utils/supabasemeals with initial value of empty arraysrc/App.jsxNeed help with component structure? Check out these snippets:
import { useState } from "react"
import supabase from "../utils/supabase"
export default function PotluckMeals() {
const [meals, setMeals] = useState([])
return <>
<h1>Potluck meals</h1>
<button>Fetch Meals</button>
<ul>
{/* Meals will be displayed here */}
</ul>
</>
}
import PotluckMeals from './components/PotluckMeals'
function App() {
return (<>
<PotluckMeals/>
</>)
}
export default App