Communicate Between Components Back

  • parent-child: just pass props
  • child-parent: use bind(this, arguments)
var handleClick = function (i, props) {
    console.log('clicked: ' + props.items[i]);

function List(props) {
    return (
       (item, i) {
                    return (
                        <div onClick={handleClick.bind(this, i, props)} key={i}>{item}</div>

    <List items={['Apple', 'Banana', 'Cranberry']} />,

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 call setState() when you receive an event.

Empty Comments
Sign in GitHub

As the plugin is integrated with a code management system like GitLab or GitHub, you may have to auth with your account before leaving comments around this article.

Notice: This plugin has used Cookie to store your token with an expiration.