Collection of helpers developed for React.
Alternate to React.addons.LinkedStateMixin
, with support for deep path-based
state access.
Example:
var WithLink = React.createClass({
mixins: [Catalyst.LinkedStateMixin],
getInitialState: function() {
return { values: [{ text: 'Hello!' }] };
},
render: function() {
return <input type="text" valueLink={this.linkState('values.0.text')} />;
}
})
Global MessageBus for components.
Quote from Communicate Between Components
For communication between two components that don't have a parent-child relationship, you can set up your own global event system. Subscribe to events in componentDidMount(), unsubscribe in componentWillUnmount(), and when you receive an event, call setState().
This mixin provides three methods:
Publish an message to a given channel, with the associated data.
Subscribe to a channel, callback
gets called when a message arrive in the
channel.
Convenient wrapper to subscribe/setState
combo.
All the listener callbacks are automagically unsubscribed when component is unmounted.
var WithMessageBus = React.createClass({
mixins: [Catalyst.MessageBusMixin],
componentDidMount: function() {
this.subscribe("customChannel", function(data) {
...
});
this.subscribeState("otherChannel", "value")
},
...
})
React.addons.update
on LinkedStateMixin
.MIT