I would like to make a dropdown which items are flags I tried a solution I found on stackoverflow but it doesn't work.
Here the sandbox link : https://codesandbox.io/embed/reverent-fermat-zssow
const CountrySelect = () => {
return (
<div className="country-select-ctn item">
<select name="country-select" id="country-select">
{countries.map((option, index) =>
<option style={{backgroundImage:`url(${option.src})`}} key={index} value={index}> //Solution A => Empty field
<img src={`${option.src}`} alt='foo' style={{backgroundImage:`url(${option.src})`}} /> //Solution B => [Object objet]
</option>
)}
</select>
</div>
); };
export default CountrySelect;
export let countries = [ { label:"France", src: require("./assets/flags/france.png"), link:" ", value:"FR" } ]
I want to know why am i getting [Object object]