Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

202
Visualizações
Is there a difference to importing specific functions/variables vs importing it entirely?

When importing functions in for example, ReactJS, I normally import only specific functions.

import { useEffect, useState, /* ETC... */ } from 'react';

But is there a difference to just importing the whole module?

import React from 'react';

Except for the fact that you'll need to do React.useState() instead of useState(), is there a difference in performance? Does it load faster etc. I know it probably reads the entire file in both cases but is anything else affected?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It's a very good question. I have already installed the extension Import Cost from VSCode which let you know the import size cost of each library and the way you import that.

This library has a post explaining it in detail. Medium Import Cost Post

I try to test it and the result is different depending on the way you import everything or just the method. Default import

VS

Selective importing

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda