baobab-react-resolver
v2.0.3
Published
Promise resolver for baobab powered applications.
Downloads
8
Readme
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