I'm new to typescript and don't know how to pass an image (svg) in a different component as a prop in typescript
this is my code:
Image Import
import internet from "./assets/internet.svg"
passing it products array along with the image into Products component
function App() {
const products = [
{
id: 1,
img: { internet },
heading: "Access a private marketplace",
desc:
"Product Description.",
},
];
return (
<main>
<Products products={products} />
</main>
);
}
Products.tsx:
```
type Product = {
id: number;
img: any; // unsure about type, "string" didn't work so i chose "any"
heading: string;
desc: string;
};
type ProductsProps = {
products: Product[];
};
const Products = ({ products }: ProductsProps) => {
return (
<div>
{products.map((product, id) => (
<div>
id: {product.id}
img: <img src={product.img} alt={product.img} />
heading: {product.heading}
desc: {product.desc}
</div>
))}
</div>
);
};
export default Products;
when i run this the alt tag returns [object Object]
```