Skeleton component: fix warning about key prop (https://github.com/woocommerce/woocommerce-blocks/pull/9018)
This commit is contained in:
parent
e8e7b43625
commit
6c86d45951
|
@ -10,11 +10,15 @@ export interface SkeletonProps {
|
|||
export const Skeleton = ( {
|
||||
numberOfLines = 1,
|
||||
}: SkeletonProps ): JSX.Element => {
|
||||
const skeletonLines = Array( numberOfLines ).fill(
|
||||
<span
|
||||
className="wc-block-components-skeleton-text-line"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
const skeletonLines = Array.from(
|
||||
{ length: numberOfLines },
|
||||
( _: undefined, index ) => (
|
||||
<span
|
||||
className="wc-block-components-skeleton-text-line"
|
||||
aria-hidden="true"
|
||||
key={ index }
|
||||
/>
|
||||
)
|
||||
);
|
||||
return (
|
||||
<div className="wc-block-components-skeleton">{ skeletonLines }</div>
|
||||
|
|
Loading…
Reference in New Issue