reactjs / reactjs/react.dev

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

Đang mở
#2,156 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Ngôn ngữ chính
JavaScript
Star
11.8k
Fork
7.9k
Merge trung bình
1 ngày 11 giờ
Pull request đã merge (30 ngày)
11

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Báo cáo đề cập đến trang chủ tại localhost:3000, các component dành riêng cho từng route và các tệp JavaScript jQuery cũ. Trước tiên, hãy xác định xem câu hỏi này có thuộc về tài liệu React hay không và kiểm tra tab Network trong khi tải trang chủ; được xem là hoàn tất khi issue có câu trả lời được ghi chép rõ ràng hoặc được chuyển hướng đến một diễn đàn phù hợp hơn.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript, jquery, react
Lĩnh vực
frontend, web-dev
Loại issue
Tài liệu
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
20/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.