pixijs / pixi-react

Write PIXI apps using React declarative style
https://pixijs.io/pixi-react/
MIT License
2.39k stars 180 forks source link

Integrating React-pixi with Meteor-React #293

Closed ashlite closed 3 years ago

ashlite commented 3 years ago

So I build a meteor-react app for a simple game and add react-pixi to it. React-pixi v6.5.0, react v17, pixi v6, meteorjs. I tried following the documentation, and try with the simple stage component. Then I get this error image There is no other react-pixi component I use for now because I can’t fix this error. And it seems that there is a conflict between meteorJS middleware and pixijs. But I don't know anymore.

inlet commented 3 years ago

Hi @ashlite could you create a codesandbox example?

ashlite commented 3 years ago

I don't have codesandbox for now. You can easily duplicate this by creating meteor-react project base on this doc https://react-tutorial.meteor.com/simple-todos/01-creating-app.html

then just change the App.jsx in imports/ui

import React from 'react'
import { Stage, Sprite } from '@inlet/react-pixi'

export const App = () => (
  <div>
    <Stage width={800} height={800}>
      <Sprite image="https://via.placeholder.com/300/FF0000" x={100} y={100} />
    </Stage>
  </div>
)

I try this using fresh install meteor js + react-pixi + pixi.js, and still producing the same error.

inlet commented 3 years ago

I have not installed Meteor on my local machine, so I cannot test it here.. but regarding to the error message it looks like you're not using the latest version of React (which is currently v17.0.2).

The react-reconciler package is considered experimental and changes over time, that's why the latest version of react-pixi is always in sync with the latest version of React.

To use an older react-reconciler implementation in react-pixi you could try to downgrade @inlet/react-pixi to v6.3.0:

npm install @inlet/react-pixi@6.3.0

See Releases and search for react-reconciler updates if you'd like to downgrade even further.

ashlite commented 3 years ago

default meteor create will adding react v16 But even though I install the latest react version (v17), it still producing the same error.