@arancini/react
Advanced tools
Comparing version 4.2.0 to 5.0.0
@@ -13,3 +13,3 @@ { | ||
"license": "MIT", | ||
"version": "4.2.0", | ||
"version": "5.0.0", | ||
"scripts": { | ||
@@ -22,3 +22,3 @@ "test": "vitest run --coverage", | ||
"dependencies": { | ||
"@arancini/core": "4.2.0" | ||
"@arancini/core": "5.0.0" | ||
}, | ||
@@ -25,0 +25,0 @@ "peerDependencies": { |
@@ -28,6 +28,2 @@ # @arancini/react | ||
world.registerSystem(MySystem) | ||
world.init() | ||
const { Entity, Entities, Component, useQuery } = | ||
@@ -65,9 +61,6 @@ createReactAPI(world) | ||
If a child is passed to `Component`, it will be captured and used as the value of the component. This is useful for keeping ECS code decoupled from React code. | ||
If a child is passed to `Component`, it will be captured and used as the value of the component. This is useful for keeping your logic decoupled from React. | ||
```tsx | ||
const world = new A.World() | ||
const ECS = createReactAPI(world) | ||
const Example = () => ( | ||
const RefCaptureExample = () => ( | ||
<Entity> | ||
@@ -121,3 +114,3 @@ <Component name="object3D"> | ||
## Querying the world | ||
## Queries | ||
@@ -130,3 +123,3 @@ ### `useQuery` | ||
const Example = () => { | ||
const entities = useQuery((e) => e.with('health')) | ||
const entitiesWithHealth = useQuery((e) => e.with('health')) | ||
@@ -136,19 +129,1 @@ // ... | ||
``` | ||
## Updating Systems | ||
`@arancini/react` does not automatically update systems for you. You will need to call `world.step` yourself. For example, if you are using arancini with `@react-three/fiber`, you can use the `useFrame` hook. | ||
```tsx | ||
import { useFrame } from '@react-three/fiber' | ||
const Game = () => { | ||
useFrame((_, delta) => { | ||
world.step(delta) | ||
}) | ||
return ( | ||
// ... | ||
) | ||
} | ||
``` |
94108
125
+ Added@arancini/core@5.0.0(transitive)
+ Added@arancini/events@5.0.0(transitive)
+ Added@arancini/pool@5.0.0(transitive)
- Removed@arancini/core@4.2.0(transitive)
Updated@arancini/core@5.0.0