Error codesState

state() sits outside a component

MARKLESS_STATE_MODULE_SCOPEerrorMarkless raises it while it builds your .tsrx files.

The message

MARKLESS_STATE_MODULE_SCOPE: Cannot create "<name>" with <callName>() at module scope.
Module-scope graph state would be shared across requests and has no per-document serialization payload.
Move state() or computed() creation into a component or declare request/container/page state with shared().
https://markless.dev/errors/MARKLESS_STATE_MODULE_SCOPE

Words in angle brackets change from case to case.

Why

A value at the top of a file belongs to every page that uses the file, not to one copy of the component. So Markless refuses state() and computed() there.

Fix

Move the call into the component body. If many components need the same value, use shared() instead.

Before

import { state } from '@markless/core';let theme = state('light');export function Settings() @{	<p>Theme: {theme}</p>}

After

export function Settings() @{	let theme = state('light');	<p>Theme: {theme}</p>}
Where Markless raises it

All error codes