I would like to know if my option can have more than one value in react.
Can anyone help me how to add new value to my option? As you see "value2" is not right way to do that.
const handleSelect = e => {
const { target } = e;
setAccount(target.value);
setAccId(target.value2);
};
console.log("account", account);
return (
<Card width bold>
New Transaction
<select
value={account}
onChange={e => handleSelect(e)}
className="transaction__select"
>
<option>Choose acc</option>
{usersAccounts &&
usersAccounts.map(acc => (
<option value={acc.accountNumber} value2={acc.id} key={acc.id}>
{acc.accountNumber}
</option>
))}
I found solution for JSON, and other to solve this, but I can't find out how to make more values for my code in react.