Skip to content

Instantly share code, notes, and snippets.

@cybersiddhu
Last active August 29, 2015 14:23
Show Gist options
  • Save cybersiddhu/ec1e7a4921883d46dc68 to your computer and use it in GitHub Desktop.
Save cybersiddhu/ec1e7a4921883d46dc68 to your computer and use it in GitHub Desktop.
import React from 'react/addons';
const TestUtils = React.addons.TestUtils;
export default createComponent;
function createComponent(component, props, ...children) {
const shallowRenderer = TestUtils.createRenderer();
shallowRenderer.render(React.createElement(component, props, children.length > 1 ? children : children[0]));
return shallowRenderer.getRenderOutput();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment