[Recompose] Configure Recompose to Build React Components from RxJS Streams

Recompose provides helper functions to stream props using an Observable library of your choice into React. This lesson shows you how to configure Recompose to use RxJS then create a Streaming Component with Recompose’s componentFromStream helper function.

import React from "react"
import { render } from "react-dom"
import { Observable } from "rxjs"
import config from "recompose/rxjsObservableConfig"
import {
  setObservableConfig,
  componentFromStream
} from "recompose"

setObservableConfig(config)

/*
APP Start
*/

const App = componentFromStream(props$ => props$.map(props => <h1>{props.message}</h1>))

render(<App message="Hello World!" />, document.getElementById("root"))
原文地址:https://www.cnblogs.com/Answer1215/p/8083873.html