1.0.9 • Published 9 years ago
sails-react-store v1.0.9
Sails React
Installation
You need sais.io.socket and sails-hook-babel
$ npm install sails-react-store sails-hook-babel --save
Usage
for record's collection
"use strict";
import React from 'react'
import {ReactItem, ReactCollection} from 'sails-react-store'
export class PostItem extends ReactItem {
render() {
return (
<div className="post">
<h5 className="post-title">{this.state.item.title}</h5>
<p className="post-content">{this.state.item.content}</p>
</div>
)
}
}
//
//
class Item {
render() {
return (
<span className="doc-title">{this.props.item.title}</span>
)
}
}
export class PostCollection extends ReactCollection {
render() {
return (
<div className="posts">
{this.state.items.map( (item,i) => {
return <Item item={item} key={i} />;
})}
</div>
)
}
}
and use like that when no attributes items => get request /post
<PostCollection identity="post" />
or if you want to add manually items
<PostCollection identity="post" items={[]} />
for one record
<PostItem identity="post" item={{title:'a title', content: 'a text content'}} />
License
MIT © 2015 contributors
1.0.9
9 years ago
1.0.8
9 years ago
1.0.7
9 years ago
1.0.6
9 years ago
1.0.5
9 years ago
1.0.4
9 years ago
1.0.3
9 years ago
1.0.2
9 years ago
1.0.1
9 years ago
1.0.0
9 years ago
0.3.2
9 years ago
0.3.1
9 years ago
0.3.0
9 years ago
0.2.11
9 years ago
0.2.10
9 years ago
0.2.9
9 years ago
0.2.8
9 years ago
0.2.7
9 years ago
0.2.6
9 years ago
0.2.5
9 years ago
0.2.4
9 years ago
0.2.3
9 years ago
0.2.2
9 years ago
0.2.1
9 years ago
0.2.0
9 years ago
0.1.11
9 years ago
0.1.10
9 years ago
0.1.9
9 years ago
0.1.8
9 years ago
0.1.7
9 years ago
0.1.6
9 years ago
0.1.5
9 years ago
0.1.4
9 years ago
0.1.3
9 years ago
0.1.2
9 years ago
0.1.1
9 years ago