2.0.3 • Published 7 years ago

baobab-react-resolver v2.0.3

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

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

2.0.3

7 years ago

2.0.2

8 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago