const [products, setProducts] = useState([]);
// Fetch array of products
async function initProducts() {
await fetch('http://127.0.0.1:5000/listProducts')
.then(response => response.json())
.then(response => {
setProducts(response.result);
console.log(response.result);
)
.catch(err => console.error(err));
}
// Get products to html with map function
function getProductsHtml() {
return products.map(product =>
<h1>{product.ProductName}</h1>
<h1>{product.ProductDescription}</h1>
);
}