[Recompose] Refactor React Render Props to Streaming Props with RxJS and Recompose
2017-12-28 03:26
423 查看
This lesson takes the concept of render props and migrates it over to streaming props by keeping the same example and simple refactoring the
Togglecomponent which handles the render prop.
const ToggleStream = componentFromStream(props$ => { const { handler: toggle, stream: toggle$ } = createEventHandler() const on$ = Observable.merge( toggle$, Observable.interval(1000) ) .startWith(true) .scan(bool => !bool) return props$.combineLatest(on$, (props, on) => props.render({ on, toggle }) ) })
相关文章推荐
- [Recompose] Stream Props to React Children with RxJS
- [Recompose] Compose Streams of React Props with Recompose’s compose and RxJS
- [Recompose] Handle React Events as Streams with RxJS and Recompose
- [Recompose] Merge RxJS Button Event Streams to Build a React Counter Component
- [Recompose] Create Stream Behaviors to Push Props in React Components with mapPropsStream
- [Recompose] Configure Recompose to Build React Components from RxJS Streams
- [Recompose] Pass a React Prop to a Stream in RxJS
- [Recompose] Stream a React Component from an Ajax Request with RxJS
- No way to generate HTML markup with data-link and helper functions in JsViews like in JsRender
- Save and render a webpage with phantomjs and node.js
- [RxJS] Aggregating Streams With Reduce And Scan using RxJS
- [RxJS] Toggle A Stream On And Off With RxJS
- [Recompose] Make Reusable React Props Streams with Lenses
- [RxJS] Starting a Stream with SwitchMap & switchMapTo
- Creating Isomorphic Apps with Node.js, React, and Express
- [Ramda] Refactor to Point Free Functions with Ramda using compose and converge
- Unable to resolve module `react/lib/ReactComponentWithPureRenderMixin`
- THE DEAD-SIMPLE STEP-BY-STEP GUIDE FOR FRONT-END DEVELOPERS TO GETTING UP AND RUNNING WITH NODE.JS,
- [Yii Framework] How to develop an extension with image, css and js
- How to disable 'withcredentials' in HTTP header with node.js and Request package?