@rxloop/react
v0.0.3
Published
react with rxloop
Downloads
3
Readme
rxloop-react
installation
npm i @rxloop/react
Usage
import rxLoop from 'rxloop';
import withRxLoop from '@rxloop/react';
const app = rxLoop();
app.model({
name: 'test',
state: {
a: 1,
},
reducers: {
setData(state, action) {
return {
...state,
a: action.data,
}
}
}
});
app.model({
name: 'user',
state: {
name: 'wxnet',
},
});
const ReactComponent = ({ streams, dispatch }) => {
streams.user$.subscribe((data) => {});
streams.test$.subscribe((data) => {});
dispatch({
type: 'test/setData',
data: 2,
});
return (<div> test </div>);
};
const RxLoopReactComponent = withRxLoop(app, ReactComponent);