Skip to content
These are temporary community docs. The official docs are in progress.Help improve them
Markless
Esc
↑↓navigate↵open⌘Jpreview
On this page

MARKLESS_STATE_WRITE_IN_TEMPLATE

An expression in the markup writes to state.

Error from the compiler, while it builds your .tsrx files.

What happened

Expressions in markup only read values. This one also writes to state, and the write wakes the same expression again.

Markless prints the message, the reason, and a suggestion:

MARKLESS_STATE_WRITE_IN_TEMPLATE: Cannot write state inside a template expression
DOM updates are the only effects in the demand-driven graph; a write inside a branch test creates a self-waking cycle that cannot resume.
Render the value directly and move the mutation to an event handler or another explicit write site.
https://markless.dev/errors/MARKLESS_STATE_WRITE_IN_TEMPLATE

How to fix it

Render the value directly. Move the write into an event handler.

Where it comes from

@markless/compiler raises this code. Source:

Read how to read a Markless error, or go back to all error codes.

Was this page helpful?