function visitNonCompositeChildren(instance, callback) {
        if(!instance) {
            return;
        }
        if (instance._renderedComponent) {
            callback(instance._renderedComponent);
            visitNonCompositeChildren(instance._renderedComponent, callback);
        } else if (instance._renderedChildren) {
            instance._renderedChildren.forEach(function(child) {
                if (child) {
                    callback(child);
                    visitNonCompositeChildren(child, callback);
                }
            });
        }
    }
Visit all child instances of a ReactCompositeComponent-like object that are
not composite components (ie. they represent DOM elements or text)