Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Expose reference from <Application /> component

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

Maintainer thường phản hồi trong vòng 1 ngày

@abstrakt8 đang làm issue này rồi.

Từ ngày 31/1/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

enhancement

Hi 👋 We’re using PlayCanvas with React in a Next.js app, where the UI and the game scene are fully separated at the top level to avoid unnecessary re-renders.

...
return (
  <ManagersProvider>
    {/* UI */}
    <GameInterface />

    {/* Game */}
    <div className='game-scene'>
      <Application {/* ref={appRef} */} {...gameApplicationOptions}>
        <GameNext />
        <Map />
      </Application>
    </div>
  </ManagersProvider>
);

In our case, we sometimes need access to the "app" object before the scene is rendered, for example to run some preprocessing logic like asset/texture loading. Right now, this is only possible via the "useApp" hook.

If it were possible to get a ref directly from the component, it would simplify these preprocessing steps quite a bit and make the architecture cleaner.

Happy to help or discuss further if this sounds useful,

Ngôn ngữ chính
TypeScript
Star
544
Fork
60
Merge trung bình
12 giờ 28 phút
Pull request đã merge (30 ngày)
10

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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.

Issue khác của playcanvas/react

Tất cả issue của playcanvas/react

Issue tương tự

Thêm issue về TypeScript

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.