Rxact React
Rxact React is a React observer for Rxact.
After setup this plugin, the instance of StateStream
will have an observer
function helping you binding stream's state to react component.
Installation
yarn add rxact rxact-react
Usage
There are two ways:
1. Install as a plugin
const stream = 'stream' name: 'rxact' stream Component ...
2. Enhance StateStream
const EnhancedStateStream = StateStream const stream = 'stream' name: 'rxact' stream Component ...
API
plugin()
Return a StateStream plugin.
decorator()
Return a function for wrapping StateStream.
stateStream.observer()
stateStream
Parameter | Type | Description | Default |
---|---|---|---|
mapStateToProps | Function | Function for mapping stream state to component state. | None |
mergeProps | Function | Function for merging result of mapStateToProps and parent props. |
None |
If you are familiar with react-redux
, you will find out it is almost as same as connect
.