Miss any of our Open RFC calls?Watch the recordings here! »

refrax-react

0.7.3 • Public • Published

refrax-react npm version

Official React bindings for Refrax.

Installation

Refrax React requires React 0.13 or later.

npm install --save refrax-react

Basic Usage

import { createSchema, createSchemaCollection } from 'refrax'
import { createContainer } from 'refrax-react'
import { Component } from 'react'
 
const schema = createSchema();
schema.addLeaf(createSchemaCollection('users'));
 
class HelloWorldComponent extends Component {
  render() {
    return (
      <div>
        <h4>Users</h4>
        <ul>
          {this.showUsers()}
        </ul>
      </div>
    )
  }
 
  showUsers() {
    if (this.isLoading()) {
      return "...Loading..."
    }
 
    return this.props.users.map((user, i) => (
      <li key={i}>{user.name}</li>
    ))
  }
}
 
const HelloWorld = createContainer(HelloWorldComponent, function() {
  return {
    users: schema.users
  }
});
 

License

Refrax React is BSD licensed.

Install

npm i refrax-react

DownloadsWeekly Downloads

1

Version

0.7.3

License

BSD-3-Clause

Last publish

Collaborators

  • avatar