create-react-phaser3-app icon indicating copy to clipboard operation
create-react-phaser3-app copied to clipboard

Click on Phaser's button and interact with react state management.

Open korrio opened this issue 2 years ago • 1 comments

Now it can fire the event to make a game object running on the scene. What if I want to click on a Phaser's object and can interact with React's functions or DOM ?

korrio avatar Nov 20 '22 10:11 korrio

Hi @korrio, sorry for my late reply.

You can use a state management library like Redux, Zustand, etc that allows you to create store and change React states from anywhere in the client code.

Here's an example from my other project, where I had Redux stores set up and I can dispatch actions to change states within a Phaser scene.

Feel free to let me know if you have more questions!

kevinshen56714 avatar Nov 27 '22 22:11 kevinshen56714