Have createReactAPI return a bound version of useEntities whose single argument is either a bucket, or a function returning a bucket. When the function form is used, a reference to the world the hook is bound to is passed into that function's first argument.
So instead of this:
import { ECS } from "./state"
const Asteroids = () => {
const asteroids = useEntities(ECS.world.with("asteroid"))
return <ECS.Entities in={asteroids} />
}
you'd now do this:
import { ECS } from "./state"
const Asteroids = () => {
const asteroids = ECS.useEntities((world) => world.with("asteroid"))
return <ECS.Entities in={asteroids} />
}
Have
createReactAPIreturn a bound version ofuseEntitieswhose single argument is either a bucket, or a function returning a bucket. When the function form is used, a reference to the world the hook is bound to is passed into that function's first argument.So instead of this:
you'd now do this: