racer-react

0.0.34 • Public • Published

Racer.js wrapper for React which allows to create realtime isomorphic applications with offline support.

In a few words racer-react allows you to query racer model in declarative way from react-router handlers:

import React, { Component } from "react";
import { Connect } from "racer-react";
import { connectRacer } from 'racer-react';
 
class TestPage extends Component {
  _submit( ev ){
    ev.preventDefault();
    this.props.racerModel.add( "test", {
      message: this.refs.message.value,
    });
  }
  render() {
    return (
      <div>
        <form onSubmit={ this._submit.bind( this ) }>
          <textarea ref="message" } />
          <button>Add</button>
        </form>
        <ul>
          { this.props.testList.map( (item, i) => {
            <li key={ i }>{ item.id }</li>
          }}
        </ul>
      </div>
    )
  }
}
 
export default connectRacer(
  query => {
    query( "test", {} ).pipeAs( "testList" );
  },
)(TestPage);

Full list of racer features is here.

Usage examples.

Package Sidebar

Install

npm i racer-react

Weekly Downloads

5

Version

0.0.34

License

MIT

Last publish

Collaborators

  • droganov