Thorm
Get started
Get Started in 5 minutes
First Page
Your first page
The controller
Header
Hero section
Contact section
The API
Considerations
Docs
Overview
Guides
Intro
Atoms
Node builders
Props helpers
State + expressions
Expression builder
Events + actions
Effects + targets
API
Api
Examples
Roadmap
Blog
Community
Get Started
GitHub
Effect Interval Increment
Increment state every second using an interval effect.
Effect: interval + inc
Tick =
Should increment once per second.
PHP
📄 Copy code
<?php $tick = state(0); $app = fragment([ el('div', [attrs(['class' => 'container p-3'])], [ el('h1', [], [ text('Effect: interval + inc') ]), el('p', [], [ text(concat('Tick = ', read($tick))) ]), el('p', [cls('text-muted')], [ text('Should increment once per second.') ]), ]), // EFFECT: every 1000ms increment tick every(1000, [ inc($tick, 1, true) ]), // asAction = true ]);