I'm trying to bind the state with a select option.
It is like a Currency dropdown menu selector and I want to choose one of the option from the header but I want to apply this option also a a text.
Like selecting the option and then getting the same option in the section text below.
But I'm getting an error "currencystate is not defined"
This is my main file:
function Currency (props) {
const [currencyState, setCurrencyState] = useState("");
return (
<div>
<select className="custom-select" onChange={(e) => {
const selectedCountry= e.target.value;
setCurrencyState(selectedCountry);
}}>
<option value="COP">COP</option>
<option value="USA">USA</option>
<option value="EUR">EUR</option>
</select>
</div>
);
}
export default Currency;
And this is where I want to apply the effect:
import React from 'react';
import './bogota.css';
function Bogota (props) {
return (
<div className="skill__wrapper">
<table className='table'>
<thead>
<tr>
<th>Dates</th>
<th>Concert</th>
<th>Singer</th>
<th>Location</th>
</tr>
</thead>
<tbody>
<tr>
<td>May 19th 2022</td> <td><span className='country__currency'> US {currencyState}
</span> $80 + 10</td>
<td>Harry Styles</td>
<td><a href='https://movistararena.co/en/'>Movistar Arena</a></td>
<td><button className='btns'>Buy</button></td>
</tr>
<tr>
<td>May 31st oct 2022</td>
<td><span className='country__currency'>US</span> $50 + 10</td>
<td>Dua Lipa</td>
<td><a href='https://movistararena.co/en/'>Movistar Arena</a></td>
<td><button className='btns'>Buy</button></td>
</tr>
<tr>
<td>Nov 20st 2022</td>
<td><span className='country__currency'>US</span> $100 + $20</td>
<td>Motomami</td>
<td><a href='https://movistararena.co/en/'>Movistar Arena</a></td>
<td><button className='btns'>Buy</button></td>
</tr>
</tbody>
</table>
</div>
);
};
How I can do the process?