I have an array
plans = [
0: {id: 2, identifier: "professional-2020", name: "professional", currency_code: "usd", price: "99.0"}
1: {id: 3, identifier: "free-2020", name: "free", currency_code: "usd", price: "0.0"}
2: {id: 4, identifier: "basic-2020", name: "basic", currency_code: "usd", price: "29.0"}
3: {id: 5, identifier: "standard-2020", name: "standard", currency_code: "usd", price: "59.0"}
4: {id: 6, identifier: "custom-2020", name: "custom", currency_code: "usd", price: "999.0"}]
I have created some Cards from this array
<Card
className="billing-plans__plans-card"
size="normal"
version="v2"
title={plan.name}
headerCenter={true}
key={plan.id}
>
{matchPlan ? (
<div className="billing-plans__current-plan-icon">
<img src={greenCheck} alt="check" />
</div>
) : null}
<div className="billing-plans__plans-card-title">
<sup>US$</sup>
{plan.price}
<sub>
/<I18nText id="pricing.plans.misc.month" />
</sub>
</div>
<div className="billing-plans__plans-card-actions">
{!matchPlan ? (
<button
className="billing-plans__plans-card-actions-button"
onClick={selectPlan}
>
<I18nText id="pricing.plans.actions.select" />
</button>
) : null}
</div>
</Card>
Now I want to get the ID of the selected Card while I click on the Button in each of the Cards. May be I need to write a function and call it in onClick?