您的位置:首页 > Web前端 > React

[Recompose] Compose Streams of React Props with Recompose’s compose and RxJS

2017-12-27 20:03 549 查看
Functions created with
mapPropsStream
canned be composed together to build up powerful streams. Bring in the
compose
helper from Recompose then simply list your functions in the order you want the props to push through.

In the example, we compose three things together, in order to create a powerful component.

1. We map user's click event to on increate and on decrease event streams.

2. We foward those count props to next stream 'loading', it will call ajax api to get Star Wars heros.

3. Last we create a typewriter to get a typing effect,

const CounterWithPersonLoader = compose(
count,
load,
typewriter
)(Counter)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: