cartons-react
v1.0.0-beta.4
Published
[](https://www.npmjs.org/package/cartons-react)
Downloads
66
Readme
Cartons React
Installation
npm install --save cartons-react
Documentation
API
observer
import Model from 'cartons/model';
import { observer } from 'cartons-react';
class Item extend Model {
...
}
@observer()
class CustomComponent extends React.Component {
render () {
const item = this.props.item;
return (
<div>{item.title}</div>
)
}
}
(
<CustomComponent item={new Item()} />
)
observe
import Model from 'cartons/model';
import { observe } from 'cartons-react';
class Item extend Model {
...
}
class CustomComponent extends React.Component {
@observe
item = new Item();
render () {
const item = this.item;
return (
<div>{item.title}</div>
)
}
}