Common Pitfalls
Patterns that catch beginners off guard. Each entry shows the wrong way, the right way, and why it matters.
Using a dynamic function to conditionally return different elements won't render anything visible:
Use when() to conditionally mount/unmount elements from the DOM:
Dynamic functions like () => value work great for text content and attributes because Nuclo re-evaluates them during update(). But elements need to be physically mounted and removed from the DOM — that's what when() is for.
Changing state without calling update() leaves the UI frozen:
Always call update() after mutating state to run a new update pass:
Creating a new object instead of mutating the existing one causes list() to destroy and recreate the DOM element:
Mutate the existing object to preserve DOM identity and skip unnecessary re-creation:
list() tracks items by object reference. Replace the reference and Nuclo treats it as a brand-new item, discarding the old DOM node and building a fresh one. Mutate in place to let the element live on.
Calling update() after every mutation causes redundant DOM passes:
Batch all mutations, then call update() exactly once:
Interpolating a variable directly captures the value at construction time — it never updates:
Wrap in an arrow function so it re-evaluates on every update():
() =>.Quick Reference
Next Steps
Core API
Deep dive into update(), list(), when(), and on().
Getting Started
Build your first Nuclo application from scratch.
Examples
See all pitfalls avoided in real working demos.
Styling
Learn the CSS-in-JS system and style helpers.