Prefer arrow function expression

TL;DR

type Product = {
  materials: string[];
  price: number;
};
const leatherProducts = products.filter((product) =>
  product.materials.includes("leather")
);
// ✅
// ❌
const leatherProducts = products.filter((product) => {
  return product.materials.includes("leather");
});
// ❌❌❌
const leatherProducts = products.filter((product) => {
  if (product.materials.includes("leather")) {
    return true;
  } else {
    return false;
  }
});

results matching ""

    No results matching ""