Preview:
  const [productsData, setProductsData] = useState({ products: [], loading: false });
  useEffect(() => {
    const fetchProducts = async () => {
      try {
        const response = await fetch(API_URL);
        const products = await response.json();
        setProductsData({
          products: products,
          loading: false
        })
      } catch (error) {
        throw new Error(error);
      }
    };
    fetchProducts();
  }, []);
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter