Promise resolver for baobab powered applications.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist
src
test
.editorconfig
.gitignore
.jscsrc
.npmignore
.travis.yml
CHANGELOG.md
LICENSE
README.md
karma.conf.js
package.json

README.md

Build Status Coverage Status npm version

baobab-react-resolver

Promise resolver for Baobab + React powered applications.

Based on Baobab cursors.

Installation

npm install --save baobab baobab-react baobab-react-schemabranchmixin baobab-react-resolver

Example

import React from 'react';
import { ResolveMixin } from 'baobab-react-resolver';
import { SchemaBranchMixin } from 'baobab-react-mixins';
import { getDataFromApi } from 'api'

export default React.createClass({
  displayName: 'Component',

  mixins: [SchemaBranchMixin, ResolveMixin],

  schema: {
    response: {
      data: {
        count: 0,
      },
    }
  },

  getResolverBindings() {
    return [
      {
        cursor: this.cursors.response,
        service: getDataFromApi,
      },
    ];
  },

  render() {
    return (
      <div>
        {JSON.stringify({this.state.response})}
      </div>
    )
  },
});

Tests

npm test

Authors

2014-2017, beda.software