Skip to main content
Hooks and the app’s own components, so your pages look like the rest of the app. React’s own hooks (useState, useEffect, …) come from react.

Hooks

useProjectState

State that survives restarts, stored separately per project. Keyed by your expansion id, so two expansions can both keep a count.

useGlobalState

The same, but shared across every project, for a preference that belongs to the expansion.
Both are for small, JSON-serialisable values. For project data, write to the project with sdk.project.

useProject

The open project’s id, or null. Follows navigation.

useNavigate

useWindowTitle

Sets the window title while the component is mounted.

Components

Buttons and inputs Layout and containers Other Components take the props the app uses for them; onChange on inputs receives the value, not the event.

Styling

Import a CSS file and it is scoped to your expansion, so plain element selectors are safe:
See Modules and imports. To restyle the app itself, use sdk.theme.

Errors

If one of your components throws while rendering, only that spot is replaced, by a card naming the file and line, with a Retry button. The rest of the app carries on. See Lifecycle.