playcanvas / playcanvas/react

Expose reference from <Application /> component

Open
#309 0 comments 1 reaction 1 assignee View on GitHub

@abstrakt8 is already working on this.

Since Jan 31, 2026.

enhancement
Dominant language
TypeScript
Stars
528
Forks
60
Avg merge
1m
Merged PRs (30d)
1

Description

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,

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.