1.0.9 • Published 10 years ago

sails-react-store v1.0.9

Weekly downloads
7
License
MIT
Repository
github
Last release
10 years ago

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

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.3.2

10 years ago

0.3.1

10 years ago

0.3.0

10 years ago

0.2.11

10 years ago

0.2.10

10 years ago

0.2.9

10 years ago

0.2.8

10 years ago

0.2.7

10 years ago

0.2.6

10 years ago

0.2.5

10 years ago

0.2.4

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.11

10 years ago

0.1.10

10 years ago

0.1.9

10 years ago

0.1.8

10 years ago

0.1.7

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago