Skip to main content

Function: useRestartGame()

useRestartGame(): () => Promise<SaveResult>

Defined in: packages/core/src/saves/hooks/useRestartGame.ts:20

React hook that provides a function to restart the game from the initial state. Loads the system save (initial game state), clears auto-save, and navigates to start passage.

Returns​

Callback function that restarts the game

(): Promise<SaveResult>

Returns​

Promise<SaveResult>

Example​

const restartGame = useRestartGame();
<button onClick={restartGame}>Restart Game</button>