Skip to content

Instantly share code, notes, and snippets.

@kitten
Created May 18, 2015 23:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kitten/4bb48f0080ee9259a790 to your computer and use it in GitHub Desktop.
Save kitten/4bb48f0080ee9259a790 to your computer and use it in GitHub Desktop.
Transmit + Store Example
import { PropTypes } from "react";
import { CompatComponent } from "react-compat-component";
import Transmit from "./transmit.js";
import ExampleStore from ",/example-store.js";
import { List } from "immutable";
class Example extends CompatComponent {
getPropTypes() {
return {
data: PropTypes.instanceOf(List).isRequired
};
}
render() {
return (
<ul>
{
this.props.food.map(obj => <li>{obj}</li>);
}
</ul>
);
}
}
export default new Transmit(Example, ExampleStore);
import Store from "./Store.js";
class ExampleStore extends Store {
doSomething() {
// ...
}
}
// ... Dispatcher Code ...
// Make this a singleton
export default new ExampleStore();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment