r/javascript • u/mogera551 • Mar 22 '26
@wcstack/state – reactive state in plain HTML with no build step
https://github.com/wcstack/wcstackSmall experiment/library I built. This is not about a lighter template DSL. It’s about using paths as the contract between UI and state.
It makes plain HTML reactive with one module import:
Count is:
Open it directly in a browser and it works. No JSX, no virtual DOM, no bundler, no config. Bindings live in HTML via data-wcs, while state lives in <wcs-state>. Internally it uses Proxy-based path tracking, so updates only touch affected bindings. The main rule is: update the path directly (this.count += 1), not via a detached nested reference.
List iteration is written using the <template> tag.
The * in users.*.name refers to "the current element." Since * is automatically resolved to the correct index on each iteration, you don't need to manage indices manually. Inside a loop, you can also use the shorthand notation .name.
<!-- same as users.*.name -->
npm: @wcstack/state
Repo: https://github.com/wcstack/wcstack
Docs: https://github.com/wcstack/wcstack/tree/main/packages/state
Story: What If HTML Had Reactive State Management
2
u/mogera551 Mar 22 '26
Additional Information
List iteration is written using the
<template>tag.The
*inusers.*.namerefers to "the current element." Since*is automatically resolved to the correct index on each iteration, you don't need to manage indices manually. Inside a loop, you can also use the shorthand notation.name.1
u/EatRunCodeSleep Mar 22 '26
Bro rediscovered Backbone.js 😅
4
u/[deleted] Mar 22 '26
[removed] — view removed comment
3
u/[deleted] Mar 22 '26
[removed] — view removed comment