Skip to content

v6.0.1 - RxJS 5 and React v16

Latest
Compare
Choose a tag to compare
@pH200 pH200 released this 07 Nov 08:28
· 13 commits to master since this release

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 and props.getAll are removed. Use pluck
    instead.
  • dispose from definitionFn is renamed to unsubscribe.
  • 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
  };
});