I wanted to use in props."restaurants".map. What could I do to use this variable in Editar2.js?
---App.js---
const { restaurantes } = this.state;
---Editar2.js---
const EscolheRestaurante = (props) => {
const opcoes = props.restaurantes.map((opcao) => {
return(<option key={opcao.idRestaurante} value={opcao.idRestaurante}>{opcao.nomeRestaurante}</option>)
})
return (
<select required className="form-select" onChange={props.idRestauranteEscolhido}>
<option value="">Escolha um restaurante</option>
{opcoes}
</select>
)
}
<select required className="form-select" onChange={props.idRestauranteEscolhido}>
<option value="">Escolha um restaurante</option>
{
props.restaurantes.map((opcao) => {
return(
<option key={opcao.idRestaurante} value={opcao.idRestaurante}>
{opcao.nomeRestaurante}
</option>
)
})
}