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

101
Views
React rerender when destructuring props

while investigating a performance issue I found out that when destructuring props inside a component I am actually triggering a rerender. This does not happen if I am using props.propName or if I am destructuring the props object directly into the component paramenters:

// Rerendering
const StatefulLayout = (props) => {
  const {isLoading, requestFn, initializationArray} = props
  useEffect(() => {
    requestFn(initializationArray);
  }, [initializationArray]);

  if (isLoading) {
    return <PageLoading />;
  }

  return (
    <Layout>
      <React.Fragment>{children}</React.Fragment>
    </Layout>
  );

// Not rerendering
const StatefulLayout = ({
  isLoading,
  requestFn,
  initializationArray
}) => {
  useEffect(() => {
    requestFn(initializationArray);
  }, [initializationArray]);

  if (isLoading) {
    return <PageLoading />;
  }

  return (
    <Layout>
      <React.Fragment>{children}</React.Fragment>
    </Layout>
  );

What this happens? What would be the correct pattern?

about 4 years ago · Juan Pablo Isaza
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!