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

236
Vistas
Prettier adding semicolon when semi: false

I have a react component with this jsx

  {posts?.map((post) => {
    <Post key={post.id} post={post} />
  })}

When I save the file prettier automatically adds a semicolon infront of <Post ... />. This is causing the component to fail to render.

I have the semi option set to false.

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

0

This is happening because currently your map function is not returning anything

<Post key={post.id} post={post} /> needs to be returned by map just like you return jsx inside your react component.

If you want to keep the one line and not explicitly return, change your curly braces to parenthesis to return your jsx

 {posts?.map((post) => (
    <Post key={post.id} post={post} />
  ))}

which is the same as

{posts?.map((post) => {
      return <Post key={post.id} post={post} />;
    })}
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