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

135
Vistas
Make two divs be resizable at the same time inside a map

I have an array named products, that has 4 different products. By mapping it, I created 4 different resizable divs, like this:

 {products.map((item, index) => {
                return (
                  <div key={index} style={{ margin: "8px 0px 0px 0px", display: "flex" }}>
                    <div className="resizable-switch-column"> 
                        <div className="switch-container">
                          <div className="switch-bar"/>
                          </div>
                      </div>
                  </div>
                );
              })}

My question is:, how can I resize all of those divs at the same time? If I resize the second one, for example, all the other 3 divs must be resized at once.

Here is my CSS code:

.switch-container {
  background-color: var(--background-secondary);
  border-radius: 4px;
  height: 16px;
  margin: auto 0px;
  width: 100%;
}

.switch-bar{
  background-color: var(--color-primary-chrome20);
  border: 1px var(--color-primary-lighten2) solid;
  border-radius: 4px;
  max-width: calc(100% - 1px);
  overflow: auto;
  height: 14px;
  resize: horizontal;
}

.switch-bar::-webkit-resizer {
  background-color: transparent;
}

This is how it works at the moment.

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

0

Maybe you can store the width inline with the useState hook.

const [width, setWidth] = useState('100%');

<div style={{width: width}} yourDraggingFunction={() => whenDragging()} />

const whenDragging = () => setWidth(someWidthVariable);

Think of this as more pseudo code and don't take it so literally. The goal is to manipulate a single state variable regardless of the which element you resize.

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