New Features
- Support for RxJS 5 has been implemented.
cycle-react
now takes the advantage of React v16. Default element for empty
Observable has been changed from<div />
to empty fragment.
Breaking Changes
- React v16 or above is required for
cycle-react
v6. props.get
andprops.getAll
are removed. Use pluck
instead.dispose
fromdefinitionFn
is renamed tounsubscribe
.rootTagName
is removed. Default element is now empty fragment[]
.
Migration
For migrating RxJS v4 to v5, see https://github.com/ReactiveX/rxjs/blob/master/MIGRATION.md
for details.
import
OLD
import {component} from 'cycle-react';
NEW
// RxJS v4
import {component} from 'cycle-react/rx';
// RxJS v5
import {component} from 'cycle-react/rxjs';
props.get
OLD
props.get('foo').map(foo => <p>{foo}</p>);
NEW
props.pluck('foo').map(foo => <p>{foo}</p>);
// or
props.map(({foo}) => <p>{foo}</p>);
dispose
OLD
const foo = component('Foo', () => {
// ...
const subscription = source.subscribe(signal => console.log(signal));
return {
view,
dispose: subscription
};
});
NEW
If you use cycle-react/rx
, cycle-react
disposes the object that has either dispose
or unsubscribe
implemented.
On the other hand, cycle-react/rxjs
only looks the object that has unsubscribe
(Subscription).
const foo = component('Foo', () => {
// ...
const subscription = source.subscribe(signal => console.log(signal));
return {
view,
unsubscribe: subscription
};
});