function Event(props) { return (
event-img
{props.title}

By {props.user_name}

{props.location}

{props.datetime}

); } function EventContainer() { //code commented used to test React // const exampleEvent = { // "title": "Zoo", // "user_id": 1, // "location": "Minnesota Zoo", // "date": "2022-11-06", // "time": "12:00", // "description": "I am going with my son this weekend", // "img": "https://i.ibb.co/zHfcq0k/chris-briggs-WNAic3c-MDR8-unsplash.jpg" // }; // const [events, setEvents] = React.useState([exampleEvent]); const [events, setEvents] = React.useState([]); React.useEffect(() => { fetch('/events.json') .then((response) => response.json()) .then((data) => setEvents(data.events)) // .then((data) => console.log(data)) }, []) const allEvents = [] for (const currentEvent of events) { allEvents.push( ); } return ( //
{ allEvents }
{allEvents}
); } ReactDOM.render(, document.querySelector('.events-container'));