Error codesState

Code reassigns state declared with const

MARKLESS_STATE_CONST_REASSIGNMENTerrorMarkless raises it while it builds your .tsrx files.

The message

MARKLESS_STATE_CONST_REASSIGNMENT: Cannot update "<target>" because it was declared with const. JavaScript const binding semantics are preserved for state().
state() removes marker syntax, but it does not change JavaScript binding rules. A const binding cannot be reassigned during resume or initial render.
Use let for scalar state you reassign, or mutate a property path on object state such as menu.open.
https://markless.dev/errors/MARKLESS_STATE_CONST_REASSIGNMENT

Words in angle brackets change from case to case.

Why

Markless keeps the normal JavaScript rules. A const binding can never get a new value, and state() does not change that.

Fix

Use let for state that you replace. A const object state still lets you change its properties, like menu.open = true.

Before

import { state } from '@markless/core';export function Settings() @{	const theme = state('light');	<button onClick={() => (theme = 'dark')}>Theme: {theme}</button>}

After

let theme = state('light');const menu = state({ open: false });
Where Markless raises it

All error codes