ampersand-react-adapter
Higher order component for react classes to easily listen for changes and re-render from ampersand models/collections. Original Author: Henrik Joreteg <henrik@andyet.net>
Last updated 2 years ago by ishan1608 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ampersand-react-adapter 
SYNC missed versions from official npm registry.

ampersand-react-adapter

Higher order component 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-adapter

example

import React from 'react';
import ampersandReactAdapter from 'ampersand-react-adapter';

class ExampleComponent extends React.Component{
	render() {
		return (
			<div></div>
		);
	}
}

export default ampersandReactAdapter(ExampleComponent);

license

MIT

NOTE

This is an effort to take the original ampersand-react-mixin library and port it to React Higher-Order Component

Current Tags

  • 1.0.0                                ...           latest (2 years ago)

1 Versions

  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (2)
Dev Dependencies (7)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |