score:0

Accepted answer
import React, { useEffect , useState } from "react";
import axios from "axios";

const Events = () => {

 const [events, setEvents] = useState([]);

  useEffect(() => {
    fetchingData();
  }, []);

  const fetchingData = () => {
    axios
      .get("http://localhost:5000/events")
      .then(response => {

         console.log('response',response.data)

         setEvents(response.data.data)
       }) // you have array in your response.data so add your data here
      .catch(err => console.log(err));
  };

//do console.log
 console.log('events',events)

  return (
    <div>
      {events.map(list => {
        return <li>{list.id}</li>;
      })}
    </div>
  );
};

export default Events;

score:1

app.get("/events", async (req, res, next) => {
  axios
    .get("http://open-api.myhelsinki.fi/v1/events/?language_filter=en")
    .then(response => res.send(response))
    .catch(err => res.status(500).send(err));
});

Related Query

More Query from same tag