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

362
Vistas
Difference between <React.Fragment> vs <>

I wanted to know the difference between <React.Fragment> versus <> in terms of the efficiency?

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

0

I think it is mostly same, with main difference:

You can use <></> the same way you’d use any other element except that it doesn’t support keys or attributes.

More.


About efficiency, IMHO there should be no difference, at least it is not documented.

Here is brief experiment, using Test1 or Test2 inside Main gives same performance more or less, if you check using React Profiler:

let array = [...new Array(1000)];

let Test1 = (props) => {
  return (
    <>
      <div>a</div>
      <div>b</div>
      <div>b</div>
    </>
  );
};

let Test2 = (props) => {
  return (
    <React.Fragment>
      <div>a</div>
      <div>b</div>
      <div>b</div>
    </React.Fragment>
  );
};

let Main = (props) => {
  return (
    <div>
      {array.map((x) => (
        <Test2 />
      ))}
    </div>
  );
};

export default function App() {
  return (
    <div>
      <Main />
    </div>
  );
}
about 4 years ago · Juan Pablo Isaza Denunciar

0

It is the same thing. The <> is just a short syntax.

about 4 years ago · Juan Pablo Isaza Denunciar

0

The <></> syntax is shorthand of <React.Fragmet> with a little difference. you Can't pass key or attributes to <>

someArray.map(item => (
        // Without the `key`, React will fire a key warning
        <React.Fragment key={item.id}>
          <dt>{item.term}</dt>
          <dd>{item.description}</dd>
        </React.Fragment>
      ))

The above example is not possible with <>

Check react docs for more info

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