ampersand-react-mixin
Mixin for react classes to easily listen for changes and re-render from ampersand models/collections
Last updated 3 years ago by dhritzkiv .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ampersand-react-mixin 
SYNC missed versions from official npm registry.

ampersand-react-mixin

Mixin for react classes to easily listen for changes and re-render from ampersand models/collections.

How it works

This auto-listens to any ampersand model or collection that is passed to it as a prop. And re-renders the component on changes. It also unregisters the listener when the component is unmounted.

You can also optionally create a method in your component called: getObservedItems.

This will get called to determine which things should be watched.

Or you can explicitly call watch on the component and pass an ampersand model, state, or collection object.

If it's a collection, it listens to 'add remove reset sort' events. If it's a State object, it listens to 'change' events.

install

npm install ampersand-react-mixin

example

var React = require('react');
var ampersandMixin = require('ampersand-react-mixin');

module.exports = React.createClass({
    mixins: [ampersandMixin],
    render: function () {
        return (
            <div></div>
        )
    }
})

license

MIT

Current Tags

  • 2.0.0                                ...           latest (3 years ago)

9 Versions

  • 2.0.0                                ...           3 years ago
  • 1.1.0                                ...           3 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
  • 0.1.4                                ...           5 years ago
  • 0.1.3                                ...           6 years ago
  • 0.1.2                                ...           6 years ago
  • 0.1.1                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (0)
None

Copyright 2014 - 2017 © taobao.org |