Created
March 16, 2017 09:49
-
-
Save couzic/cbd4cf73f5f4fc2a8f57b2bb48c1d46c to your computer and use it in GitHub Desktop.
react-rx-pure-connect Advanced Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {connect} from 'react-rx-pure-connect' | |
| const Component = (props: {name: string}) => <h2>Name: {props.name}</h2> | |
| const mapProps = (props: {personId: number}) => Observable.ajax | |
| .getJSON(`/api/person/${props.personId}`) | |
| .map(person => ({name: person.name})) | |
| const Name = connect(mapProps)(Component) | |
| // Rendered as "<h2>Name: Bob</h2>" | |
| <Name personId={123} /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment