Skip to content
filedom
Esc
↑↓navigate↵open⌘Jpreview
On this page

useInitialSetup

Keeps startup loading active while game assets are prepared.

import { useInitialSetup } from 'filedom';

useInitialSetup({ ready: assets !== null, error, label: 'Board assets' });

if (!assets) return null;
return <Board assets={assets} />;

Call it on the first render, before any early return, and render the prepared content in the same commit that passes ready: true. The hook holds startup readiness until ready is true or error is set; an error fails the startup instead. It runs once at startup and is not meant for loading states during play.

Options

PropType
readyboolean

True once preparation has completed.

Typeboolean
error?unknown

Preparation failure, if any. A non-null value fails startup.

Typeunknown
label?string

Label for the timing log, read once on mount. Default 'Game setup'.

Typestring

Returns

Nothing (void).

Was this page helpful?