reactjs / reactjs/react.dev

Is it possible to load specific files only when the current route requires them?

Aberta
#2,156 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Linguagem predominante
JavaScript
Estrelas
11.8k
Forks
7.9k
Merge médio
1d 11h
PRs com merge (30d)
11

Descrição

Hi. I have an app that uses old .js files from a previous development of my website (in jQuery) which I'm introducing to this project as I'm redesigning my website and only want to load the old apps I made without having to go through the ordeal of re-coding them again to fully match ReactJS standards. It all works, however since each of these apps used a separate .js file to function, I have pasted them into the project as new files, and now when I load the homepage (localhost:3000), all the resources that are mentioned on these javascript files are loaded along with it (even if only a few bytes of each), not on the page body, but on the Network tab of the Chrome developer tools, and I assume into a similar location in other browsers, which would consume memory. Is there a way to tell React not to load these specific files unless the component that uses functions from them requires them?

Is this even the right place to ask this question? Please let me know, and I'll close the issue and ask in a more appropriate location

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

O relatório faz referência à página inicial em localhost:3000, a componentes específicos de rotas e a arquivos JavaScript antigos do jQuery. Comece determinando se esta pergunta pertence à documentação do React e verificando a aba Network enquanto a página inicial é carregada; considera-se concluído quando a issue tem uma resposta claramente documentada ou é redirecionada para um fórum mais apropriado.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
javascript, jquery, react
Domínio
frontend, web-dev
Tipo de issue
Documentação
Dificuldade
5/5
Tempo estimado
Mais de uma semana
Status de atividade
Estagnada
Clareza
Precisa de esclarecimento
Facilidade para iniciantes
20/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.