Promise resolver for Baobab + React powered applications.
npm install --save baobab baobab-react baobab-react-schemabranchmixin baobab-react-resolver
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>
)
},
});