Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

reactive-box simple counter

node v10.24.1
version: master
endpointsharetweet
const { box, sel, expr } = require("reactive-box"); const [getCounter, setCounter] = box(0); const [getNext] = sel(() => getCounter() + 1); const increment = () => setCounter(getCounter() + 1); const [run] = expr(() => { console.log(`Counter: ${getCounter()} (next value: ${getNext()})`) }); run(); increment();
Created from: https://npm.runkit.com/reactive-box
Loading…

no comments

    sign in to comment