Relay-inspired library based on Promises instead of GraphQL.
Relay-inspired library based on Promises instead of GraphQL.
Relay-inspired library based on Promises instead of GraphQL.
Inspired by: Building the Facebook Newsfeed with Relay (React blog)
# For web or Node:
npm install react-transmit
# For React Native:
npm install react-transmit-nativeNewsfeed.js (read the comments)
…` Story.js (read the comments)
import React from "react";
import Transmit from "react-transmit"; // Import Transmit.
const Story = React.createClass({
render () {
const {story} = this.props; // Fragments are guaranteed.
return
{story.content}
;
}
});
export default Transmit.createContainer(Story, {
fragments: {
// This "story" fragment returns a Fetch API promise.
story ({storyId}) {
return fetch("https://some.api/stories/" + storyId).then(res => res.json());
}
}
});See DOCS.md
Let's start one together! After you ★Star this project, follow me @Rygu on Twitter.
BSD 3-Clause license. Copyright © 2015, Rick Wong. All rights reserved.
No open issues yet, or sync has not completed.