First time seeing an error like this so please bear with me.
I was working on a project and opened one file to make a change. I opened the file, didn't actually make any change and just formatted the file using Prettier.
Right when it formatted, the project threw the error below:
TypeScript error in C:/Users/name/source/repos/UsedEquipment/src/pages/listings/sections/SearchResultListings.tsx(253,16):
Type '{ style: { height: string; }; type: "rect"; ready: false; showLoadingAnimation: true; }' is not assignable to type '(IntrinsicAttributes & CommonProps & { color?: string | undefined; rows?: number | undefined; showLoadingAnimation?: boolean | undefined; customPlaceholder?: undefined; } & Pick<...> & { ...; } & { ...; }) | ... 4 more ... | (IntrinsicAttributes & ... 2 more ... & { ...; })'.
Property 'children' is missing in type '{ style: { height: string; }; type: "rect"; ready: false; showLoadingAnimation: true; }' but required in type 'CommonProps'. TS2322
Here's the code where the error's thrown:
showPlaceholders() {
let items: Object[] = [];
for (let i = 0; i < ITEMSPERPAGE; i++) {
//show # of placeholders
items.push(
<div
className="productwrap col-xs-12 col-sm-4 col-md-4 col-lg-3 placeholder"
key={i}
>
<div className="product-wrapper">
<div className="product-image">
<ReactPlaceholder
^ Error thrown here
style={{ height: "180px" }}
type="rect"
ready={false}
showLoadingAnimation={true}
></ReactPlaceholder>
</div>
<div className="product-info-column">
<ReactPlaceholder
^ Error thrown here
type="text"
rows={6}
ready={false}
showLoadingAnimation={true}
></ReactPlaceholder>
</div>
</div>
</div>
);
}
return items;
}
I'm not entirely sure what this error means or how to fix it. Any idea?
React Placeholder expects one child component. Pass in any valid html tag inside it.
<ReactPlaceholder { /*...your other optional props */ }>
<MyComponent /> {/* this is mandatory */ }
</ReactPlaceholder>
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments