Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

359
Views
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 answers
Answer question

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 Report

0

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

about 4 years ago · Juan Pablo Isaza Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!