0024

PHOTO EMBED

Mon Dec 06 2021 14:08:29 GMT+0000 (UTC)

Saved by @Matt #useeffect

index.js

import MeetupList from "./../components/meetups/MeetupList";
import { useEffect } from "react";
import { useState } from "react";

const data = [
  {
    id: "m1",
    title: "A first meetup",
    image: “/location.jpg”,
    address: "Some address 10, 12345 Some city",
    description: "This is a first meetup!",
  },
  {
    id: "m2",
    title: "A second meetup",
    image:“/location.jpg”,
    address: "Some address 20, 6789 Some city",
    description: "This is a second meetup!",
  },
];

const HomePage = () => {
  const [loadedMeetups, setLoadedMeetups] = useState([]);

  useEffect(() => {
    // send http request and fetch data
    setLoadedMeetups(data);
  }, []);

  return (
    <>
      <MeetupList meetups={loadedMeetups} />
    </>
  );
};

export default HomePage;
content_copyCOPY

https://docs.google.com/document/d/1Fxoh7R_7TExsGfvmNWcryqO9d7-3x0sP3dwXKCZU4Yo/edit