I am displaying thumbnail images for products in my app, which i get from a third party URL when constructing a string like: “productbase.no/produkt/{{productID}}/produktbilde”. However sometimes the URL returns broken formats or a 404.
Is there anyway to fallback to a placeholder image (a resource file) when the imageUrl fails? <img src={https://produktbase.no/produkt/${productID}/produktbilde} onerror=“this.src=‘https://storage.googleapis.com/appfarm-public/.../placeholder.png’” /> something equivalent onerror in the html img tag.
Alt text only displays string and can’t render a image so that doesn’t solve it either.
Ive tried fetching the URL and checking the response in function editor, but that’s seems like an excessive solution, especially for 300k products. And ive ran into some complications with fetching async from client in function editor.