API services for Next/React JS app

imsan

San

Posted on September 12, 2023

API services for Next/React JS app
export async function fetchProducts() {
  try {
    const url = "https://dummyjson.com/products/";
    const res = await fetch(url);
    const result = await res.json();
    return result;
  } catch (err) {
    console.log("error fetching products==>", err);
  }
}
Enter fullscreen mode Exit fullscreen mode
๐Ÿ’– ๐Ÿ’ช ๐Ÿ™… ๐Ÿšฉ
imsan
San

Posted on September 12, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

ยฉ TheLazy.dev

About