Skip to content

Latest commit

 

History

History
17 lines (11 loc) · 451 Bytes

nodejs.md

File metadata and controls

17 lines (11 loc) · 451 Bytes

Pure reactivity in Node.js

import { box, get, set, update, wrap, on } from 'remini'

const $value = box(0)
const $next = wrap(() => get($value) + 1)

on($next, n => console.log('Next value: ' + n))

update($value, n => n + 1)  // Next value: 2
set($value, 2)            // Next value: 3

console.log(get($next))    // 3

Try it on RunKit