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

201
Vistas
How to push item in specific index of and array of useState reactJs

In this case I've and array by using useState

const [acts, setActs] = useState([])

now the point is that I want to push item at 4th index in array, and it should look like this

['', '', '', '' ,'should be here', '', '']

So, the method I'm trying to do this is here

let actsArray = []
const [acts, setActs] = useState(actsArray)

const addItem = (index) => {
   actsArray.splice(index, 0, 'Should be here')
   setActs(actsArray)
}
about 4 years ago · Juan Pablo Isaza
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