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

124
Views
React.js: Passing props using JS Destructring

In react.js, are there any differences between the following two approaches? like in terms of performance etc?

  1. <SomeComponent props1={props1} props2={props2} />

  2. <SomeComponent { ...{props1, props2} } />

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

use babel, see result:

const component1 = <SomeComponent props1={props1} props2={props2} />
const component2 = <SomeComponent { ...{props1, props2} } />
"use strict";

const component1 = /*#__PURE__*/React.createElement(SomeComponent, {
  props1: props1,
  props2: props2
});
const component2 = /*#__PURE__*/React.createElement(SomeComponent, {
  props1,
  props2
});
about 4 years ago · Juan Pablo Isaza Report

0

Those two approaches are exactly same in performance. Because spread operator doesn't affect to the performance. I think the second one is the good use case than the first one.

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!