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

169
Vistas
Mapping inside a map function, while getting the data from the state a of parent component

When it goes to getDropDownOptions, I get this error - Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops. I'm not using any componentWillUpdate or componentDidUpdate, neither setting state anywhere related to this functionality. rowInfo is the Items inside an array, that Im mapping. allProducts is the data I'm getting from a parent component.

    return (
      <SelectBox
        options={getDropdownOptions}
        value={{ label: '', value: '' }}
        onChange={e =>
          onItemChange({
            itemKey: headerItem.itemKey,
            arrayIndex: index,
            value: { label: e.value, value: e.value }
          })
        }
        customClass="lineItemDropdown"
      /> ```


const getDropdownOptions = () => {
    const dropDownOptions = allProducts.find(
      product => product.productId === rowInfo.productId
    ).packages;
    return dropDownOptions;
  };

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

0

In your example you are passing a reference to a function for options instead of the value that the function returns.

Right now, if you were to console.log(props.options), you would see a function....but you need an array.

So try this:

<SelectBox
  options={getDropdownOptions()}
  ...       
/>

OR, instead of using a function, just set a variable:

const dropDownOptions = allProducts.find(
      product => product.productId === rowInfo.productId
    ).packages;
    return dropDownOptions;

return (
   <SelectBox
     options={dropDownOptions}
     ...       
   />
)
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