Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

reactive-component

Reactive template engine with data bindings

reactive, template, engine, data, bind, bindings

readme

reactive

Reactive template engine

Installation

$ component install component/reactive

Example

Simply invoke reactive() on the element to wish to become the "template" for obj. The given obj must emit "change" events passing (prop, val), the template will react to these changes.

var reactive = require('reactive');
reactive(el, obj);

You may also map custom callbacks for formatting or messing with an element based on a change. The element, value, and object itself are passed as arguments.

var reactive = require('reactive');
reactive(el, user, {
  birthdate: function(el, date, user){
    el.textContent = date.getFullYear() + '/' + date.getMonth() + '/' + date.getDate();
  }
});

Todo

  • composition of smaller templates instead of conditionals etc..
  • defer .render() and use .change('birthdate', fn) instead of object-literal
  • moar docs / examples

License

MIT