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

178
Vistas
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 Respuestas
Responde la pregunta

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 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