AccountBalance.jsx:
export default function AccountBalance(props) {
const buttonText = props.showBalance ? "Hide Balance" : "Show Balance";
return (
<Section>
{props.showBalance ? <span>Balance: ${props.amount}</span> : null}
<button onClick={props.toggleBalance}>{buttonText}</button>
</Section>
);
}
CoinList.jsx:
export default function CoinList(props) {
return (
<CoinTable>
<thead>
<tr>
<th>Name</th>
<th>Ticker</th>
<th>Price</th>
{props.showBalance ? <th>Balance</th> : null}
<th>Actions</th>
</tr>
</thead>
<tbody>
{
props.coinData.map( ({key, name, ticker, price, balance}) =>
<Coin key={key}
tickerID={key}
handleRefresh={props.handleRefresh}
showBalance={props.showBalance}
name={name}
ticker={ticker}
balance={balance}
price={price} />
)
}
</tbody>
</CoinTable>
)
}