reactive x react = xreact
and some devDeps...
intent$.send
will now become intent$.next
the same API as RxJs Subject and Most Subject
sink$
is now update$
component.machine
connect(blah)
where blah function should be a Plan
type, a Plan
must return a Machine
add display name for Connect wrapper
to easily debug on react chrome plugin
e.g. wrapper component's name will be Connect(Counter)
let wrapper1 = connect(i=>({inc1: ()=>({type: 'inc'})}))
let wrapper2 = connect(i=>({inc2: ()=>({type: 'inc2'})}))
wrapper1(wrapper2(CounterView))
// wrapper are simply function, so you can
let wrapper = R.compose(wrapper1, wrapper2)
wrapper(CounterView)
actions
as default field to define actions const Counter = connect(intent$=>{
return {
sink$: intent$.map(...),
inc: ()=>({type:'inc'}), // <-- these are actions,
dec: ()=>({type:'dec'}), // <-- if it confuse you why they're same level with sink$
actions: { // <-- now you can put all actions inside `actions` field
inc3: ()=>({type: 'inc3'})
},
}
})(CounterView)
env NODE_ENV=debug npm test
to see intent time stampconst View = props => <div>hehe</div>
View.defaultProps = {blah} // <-- 1 defaultProps
const Component = connect(blah, initprops)(View) // <--- 2. initprops
<Component props={blah}> // <--- 3. props
piority 3>2>1