Reputation: 153
new to typescript can anyone explain what is the meaning of this sign <->? Just to confrim, ProductList is actually a function? in the following code.
export const ProductList: React.FC<-> = ({
displayLoader,
hasNextPage,
notFound,
onLoadMore,
products,
totalCount,
}) => {
const hasProducts = !!totalCount;
return (
<div className="products-list">
<div className="products-list__products container">
{hasProducts ? (
<>
<div className="products-list__products__grid">
{products.map(product => (
<Link
to={generateProductUrl(product.id, product.name)}
key={product.id}
>
<ProductListItem product={product} />
</Link>
))}
</div>
<div className="products-list__products__load-more">
{displayLoader ? (
<Loader />
) : (
hasNextPage && (
<Button secondary onClick={onLoadMore}>
Load more products
</Button>
)
)}
</div>
</>
) : (
<div className="products-list__products-not-found">{notFound}</div>
)}
</div>
</div>
);
};
Please advice. Thank you so much.
Upvotes: 2
Views: 92
Reputation: 2760
There should be an interface
that will describe a shape of your props object instead of -
. Should look something like this React.FC<IProductListProps>
. You might get that mistake while copy-pasting. There is no such operator like this <->
in TypeScript
Upvotes: 1