useGame
You can access the game object using this hook.
Note: this hook can only be used in a component that is a descendant of GameProvider.
function useGame(): GameContextType;
- For GameContextType, see GameContextType.
Usage
import {useGame} from "narraleaf-react";
function myComponent() {
const game = useGame();
useEffect(() => {
// ...
}, [game]);
}