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.
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.