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

91
Vistas
How to rerender {#each array} block in svelte after you push something to an array

Hello I'm making a comment section for my website which works but when I push an object to an array my {#each} block doesn't update here is this block of code

            {#each commentsScript as { userName, rating, comment }, i}
                <div class="flex">
                    <div class="w-1/4">
                        <h5>{userName}</h5>
                        <h5>{rating}</h5>
                    </div>
                    <div class="w-3/4">
                        <p>{comment}</p>
                    </div>
                </div>
            {/each}

In my script section, I push a new comment to an array and it does show up after I refresh the page but I want to rerender it as soon as the user leaves a comment so the user would see hes/her own comment so is there any way I can rerender it?

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

0

https://svelte.dev/tutorial/updating-arrays-and-objects

You have to assign commentsScript = commentsScript, which would be redundant normally, but that is how svelte works. This is true if you are using push function on array.

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