UNPKG

comfey

Version:

Tiny micro mini data binding library inspired by react hook useState

13 lines (10 loc) 312 B
import Comfey from 'comfey'; const app = new Comfey(); const [, setMessage] = app.useState('stateMessage', false, messageWatcher); function messageWatcher(message) { console.clear(); console.log({ message }); } setInterval(() => { setMessage(Math.random() > 0.5 ? 'Hello World!' : 'Comfey 2'); }, 1000);