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

177
Views
Is better for performance to destructure dependency imports in create-react-app?

Does it improve performance if I only import what I need? I think it depends on certain webpack config, is that true? if yes does create-react-app have that config integrated by default? How do I test how much performance I am gaining by doing this?

For example instead of this:

import React from "react";
import ReactDOM from "react-dom/client";

const root = ReactDOM.createRoot(document.getElementById("root") as HTMLElement);

root.render(
  <React.Fragment>
    <h1>Hello</h1>
  </React.Fragment>
);

I can use dependencies this way:

import { Fragment } from "react";
import { createRoot } from "react-dom/client";

const root = createRoot(document.getElementById("root") as HTMLElement);

root.render(
  <Fragment>
    <h1>Hello</h1>
  </Fragment>
);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You won't gain any performance by such imports.
Only thing you can reach by destructuring imports is reduce bundle size (read about tree-shaking).
But in case of import of react I afraid it won't make any effect, you can check size of builded budnle with and without destructuring

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!