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.
Type
booleanerror?unknown
Preparation failure, if any. A non-null value fails startup.
Type
unknownlabel?string
Label for the timing log, read once on mount. Default 'Game setup'.
Type
stringReturns
Nothing (void).