Fetch RSS feed

PHOTO EMBED

Tue Oct 05 2021 05:46:33 GMT+0000 (Coordinated Universal Time)

Saved by @caesaragen #react.js

const [feed, setFeed] = useState([]);
useEffect(() => {
    async function fetchData() {
      const response = await fetch(
        "https://www.sciencedaily.com/rss/earth_climate/environmental_issues.xml"
      )
        .then((response) => response.text())
        .then((responseData) => rssParser.parse(responseData))
        .then((rss) => {
          // console.log(rss.items);
          setFeed(rss.items);
        });
    }
    fetchData();
  }, []);
content_copyCOPY