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

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.ajax

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

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

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

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

const CounterWithPersonLoader = compose(
  count,
  load,
  typewriter
)(Counter)
相關文章
相關標籤/搜索