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

170
Vistas
How to keep track of the id number in an object when you iterate and add another object to it

I want to add another object to my exiting object but i doesn't get the value as others object have instead it gets a text, I tried a easy solution but didn't work, here is that i'm facing:

ConsoleLog Image

So instead of the key long I want to keep the numbers as they started from 0, but I don't know how?

Here is what I've tried:

  const addToWatchlist = (movie) => {
    const long = movies.length;
    const data = {...movies, long: movie};
    setMovies(movies)

ps: I'm using React.

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

0

const addToWatchlist = (movie) => {
movies.push(movie)
setMovies(movies)

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