0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-01 02:41:39 -05:00

Fixed react key warnings

no refs

- fixes key warnings from react by cleaning up key references across products and benefits
This commit is contained in:
Rishabh 2021-09-27 20:03:56 +05:30
parent b3969fea34
commit 19a8f6abb9

View file

@ -78,7 +78,7 @@ export const ProductsSectionStyles = ({site}) => {
padding: 0px 4px;
text-align: center;
}
.gh-portal-discount-label:before {
position: absolute;
content: "";
@ -537,9 +537,10 @@ function ProductBenefits({product}) {
return null;
}
return product.benefits.map((benefit) => {
return product.benefits.map((benefit, idx) => {
const key = benefit?.id || `benefit-${idx}`;
return (
<div className="gh-portal-product-benefit">
<div className="gh-portal-product-benefit" key={key}>
<CheckmarkIcon className='gh-portal-benefit-checkmark' alt=''/>
<div className="gh-portal-benefit-title">{benefit.name}</div>
</div>
@ -622,7 +623,7 @@ function ProductCard({product}) {
</div>
{/* Vertical version */}
<div className={cardClass + ' vertical'} key={product.id} onClick={(e) => {
<div className={cardClass + ' vertical'} key={`${product.id}-vertical`} onClick={(e) => {
e.stopPropagation();
setSelectedProduct(product.id);
}}>