Tested the new libs

This commit is contained in:
2021-03-24 01:53:33 +11:00
parent 6b53bee033
commit ff0230b77f
+5 -1
View File
@@ -1,11 +1,15 @@
import React, { useState, useEffect } from 'react';
import dateFormat from 'dateformat';
//DOCS: props.uri is the address of a live news-server
const NewsFeed = props => {
const [articles, setArticles] = useState([]);
useEffect(async () => {
if (articles.length != 0) { //BUGFIX: There's an extra render called on unmounted components somewhere
return;
}
//NOTE: could this be improved with useMemo?
const result = await fetch(`${process.env.NEWS_URI}/news`, {
method: 'GET',
headers: {