@latticexyz/react
TypeScript icon, indicating that this package has built-in type declarations

2.0.7 • Public • Published

MUD React

React hooks (and more) for building MUD clients.

Hooks for recs

useComponentValue

Returns the value of the component for the entity, and triggers a re-render as the component is added/removed/updated.

const position = useComponentValue(Position, entity);

useEntityQuery

Returns all matching EntityIndexes for a given entity query, and triggers a re-render as new query results come in.

const entities = useEntityQuery([Has(Position)]);
const playersAtPosition = useEntityQuery([Has(Player), HasValue(Position, { x: 0, y: 0 })]);

Readme

Keywords

none

Package Sidebar

Install

npm i @latticexyz/react

Weekly Downloads

4,044

Version

2.0.7

License

MIT

Unpacked Size

50 kB

Total Files

16

Last publish

Collaborators

  • holic
  • alvarius
  • l_udens