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

372
Vistas
react: ReactGridLayout.children[0].x must be a number

The issue is not similar to the one with the same title.

I am using react hook to create my own dynamic add/remove using this example to create my dynamic add/remove.

As the title suggests, the error message happens when clicking the 'create item' button.

This is my codesandbox link that shows my code and the error. Any help is appreciated.

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

0

The issue you were having is that your widget state is set as an array of objects but when you were updating that state in the onAddItem function you were setting the it as an object.

Here's the onAddItem function where the widget state is being updated with the previous state and the new state into a new array.

const onAddItem = () => {
    setCounter(counter + 1);
    setWidgetList([
      ...widget,
      {
        i: "chart" + counter,
        x: (widget.length * 2) % (cols || 12),
        y: Infinity, // puts it at the bottom
        w: 2,
        h: 2
      }
    ]);
  };
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