Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

166
Vistas
Select in form - Problem mapping through options, cannot read properties of undefined (reading 'map')

I am creating a SELECT inside a form in which I need to map through an object (I know mapping through an object instead of an array might be a problem). I am using antd to format my code. I would like to know what I am doing wrong.

Right after the React imports I declared my like const networks = [{...},{...},...]

Then my export looks like:

export class BasicDetails extends Component {
  state = {
    selectedOption: null,
  };

  handleChange = selectedOption => {
    this.setState({ selectedOption }, () =>
      console.log(`Option selected:`, selectedOption),
    );
  };

And my render/return looks like

render() {
    const { values, handleChange } = this.props;
    const { selectedOption } = this.state;

    return (
<>

            {/* Chain selector */}

            <Select
              style={{ width: 120 }}
              value={selectedOption}
              onChange={this.handleChange}
              Option={this.props.networks.map((network, index) => {
                return {
                  label: network.name,
                  value: network,
                  key: index,
                };
              })}
            />

Can anybody help me please? I am a junior dev. :) Thanks

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Solved. I was using Option={this.props.networks.map((network, index) instead of Option={this.state.networks.map((network, index)

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda