this.props.children undefined Back

You can't access the children of your component through this.props.children, which should only be the children being passed onto your component by the owner:

var MyComponent = React.createClass({
    componentDidMount: function () {
        console.log(this.props.children);   /** => undefined */
    },

    render: function () {
        return (
            <div>
                <span></span>
            </div>
        );
    }
});

ReactDOM.render(
    <MyComponent />,
    document.getElementById('content')
);

Of course, if you want to access children of your own component, you can use ref:

var MyComponent = React.createClass({
    componentDidMount: function () {
        console.log(this.refs.child__elem);   /** => <span></span> */
    },

    render: function () {
        return (
            <div>
                <span ref="child__elem"></span>
            </div>
        );
    }
});

ReactDOM.render(
    <MyComponent />,
    document.getElementById('content')
);
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.