cycle-react
Advanced tools
Changelog
7.0.0
Almost everything for cycle-react has changed. If you're migrating your current cycle-react application to 7.0, probably jsx and model are the only parts that can be reused.
Please check examples for migration guide.
Changelog
6.0.1
cycle-react
now takes the advantage of React v16. Default element for empty
Observable has been changed from <div />
to empty fragment.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 []
.For migrating RxJS v4 to v5, see https://github.com/ReactiveX/rxjs/blob/master/MIGRATION.md for details.
import {component} from 'cycle-react';
// RxJS v4
import {component} from 'cycle-react/rx';
// RxJS v5
import {component} from 'cycle-react/rxjs';
Changelog
5.1.2
Compatibility fix for create-react-app
and react-scripts
The NPM package cycle-react
now contains transpiled code that built
by Babel. This fixes react-scripts build
's compatibility issue with
ES6.
The underlying component class has been changed from PureComponent
to Component
, due to implementation of shouldComponentUpdate
raises
warning message for PureComponent
.
Changelog
5.0.0
Breaking change: Custom events is now subscribed only when listener props is provided upon componentDidMountEvent [#37]
For example, if you have following component:
<MyTimer />
And you add the event listener after the component has mounted:
<MyTimer onTick={listener('x')} />
The onTick
event will be no longer raised for this cycle-react version.
Breaking change: mixin
is removed along with the usage of createClass
Breaking change: self
and renderScheduler
have been removed
As a result, lifecycles
parameter has moved to the third parameter of
definitionFn
. For handling refs,
please use interactions
for generating callback function.
See "Working with React" for further details.
Breaking change: cycle-react
is now native ES6
Use any transplier if you need backward compatibility for cycle-react
.
If you are using Babel already you should have
no problem.
In addition, the following features are not used in cycle-react to ensure minimum dependency and good efficiency for all browsers.
You can still use any of the features above in your project with cycle-react. In fact, using destructuring assignment with cycle-react is recommended.
View component is a new way to define cycle-react components by divorcing view function from the component. For example, the original component function allows you to define the component like this:
component('Hello', (interactions) =>
interactions.get('OnNameChanged')
.map(ev => ev.target.value)
.startWith('')
.map(name =>
<div>
<label>Name:</label>
<input type="text" onChange={interactions.listener('OnNameChanged')} />
<hr />
<h1>Hello {name}</h1>
</div>
)
);
New view component extracts the view function out of component definition:
viewComponent(
'Hello',
(interactions) =>
interactions.get('OnNameChanged')
.map(ev => ev.target.value)
.startWith(''),
// View function
(name, {OnNameChanged}) => (
<div>
<label>Name:</label>
<input type="text" onChange={OnNameChanged} />
<hr />
<h1>Hello {name}</h1>
</div>
)
);
Changelog
4.0.0
Breaking change: rx
is a peer dependency now [#21]
Breaking change: The shortcut for React and Rx are both removed [#21]
Add feature: Added render scheduler for supporting refs,
see working-with-react.md
for the details [#23]
Fix: The feature of using function wrapper for view is no longer deprecated [#23]
Fix: The onCompleted
signal will be emitted for all lifecycle observables
before the component being unmounted