GitXplorerGitXplorer
a

retransmitter

public
12 stars
1 forks
0 issues

Commits

List of commits on branch master.
Unverified
6a203890587e62b6f958d42e1681c4e43ca748f8

removed unnecessary function

aalexeyraspopov committed 9 years ago
Unverified
b540ee94ab342c687db298e63a5f48840719511a

bad luck

aalexeyraspopov committed 9 years ago
Unverified
686b0a7582002fb8d9459122a6e13beb77b2a639

got rid of rx. it's useless

aalexeyraspopov committed 9 years ago
Unverified
c76d7104bb07570fae0e94fd1fbe2b058d831471

updated react version

aalexeyraspopov committed 9 years ago
Unverified
a4bee3df1d5467cf4c9a19a22a79b9785d41f147

keyword

aalexeyraspopov committed 9 years ago
Unverified
0565cdcb1359de9e7b143a73d842da83e5f616ca

used assign instead of spread

aalexeyraspopov committed 9 years ago

README

The README file for this repository.

Transmitter

Async data fetching from different sources for React components made easy.

The project is under heavy development and the API can be changed.

Inspired by Relay. An attempt to create unified container solution.

NB: Transmitter depends on Rx (used as peer dependency).

Quick Look

import AsyncComponent from 'retransmitter/lib/AsyncComponent';

// this component will be used for react-router
// like <Route path="/users/:userId" component={UserInfoPage} />
export default AsyncComponent(UserInfoPage);

async function UserInfoPage({params: {userId}}) {
	const user = await UsersAPI.find({id: userId});

	return <UserInfo user={user} />;
}
import Container from 'retransmitter/lib/Container';
import fromStore from 'retransmitter/lib/fromStore';

class TodosListContainer extends Container {
	observe() {
		return {
			todos: TodosAPI.getAll(),
			query: fromStore(TheStore).map(state => state.query),
		};
	}

	render() {
		const {status, todos, query} = this.state;

		switch (status) {
		case 'success':
			return <TodosList todos={todos} query={query} />;

		case 'failure':
			return <ErrorMessage />;

		case 'pending':
			return <Spinner />;
		}
	}
}

Introduction

Read more in docs

Installation

Install via NPM:

npm install --save retransmitter

Require the lib in your code:

import Transmitter from 'retransmitter';

Also you can require particular components:

import AsyncComponent from 'retransmitter/lib/AsyncComponent';
import Container from 'retransmitter/lib/Container';
import fromStore from 'retransmitter/lib/fromStore';

Still using that old syntax?

var Transmitter = require('retransmitter');

NB: If you're NPM3 user please make sure you have these dependencies installed. I'll make these dependencies as own dependencies after NPM3 will be used widely.

Support

  • [x] Promises
  • [x] Observables
  • [x] Falcor (since it uses Promises and Observables)
  • [x] Stores (Flux, Redux)
  • [ ] CSP channels
  • [ ] Relay