Reference
React hook
import { … } from "@johnmorrisdotca/narabe/react";
27.1 kB minified and gzipped, with everything it imports (measured with esbuild)
useNarabe, a React hook over the engine: one game's state and the moves a
board can make on it. It adds no rule of its own; every action is the
engine function of the same name, and an illegal one leaves the state as it
was, exactly as the engine does.
Drawing the board is left to you, because every app draws its boards its own way. The demo in this repository draws one in plain SVG.
Exports
| Name | Kind | What it is |
|---|---|---|
NarabeGame | type | A React game state and its native move, replay and reset actions. |
useNarabe | function | One game, kept in React state. |