Skip to content

Instantly share code, notes, and snippets.

@JedWatson
Last active August 29, 2015 14:24
Show Gist options
  • Save JedWatson/40fe0e4fa393ba943bf9 to your computer and use it in GitHub Desktop.
Save JedWatson/40fe0e4fa393ba943bf9 to your computer and use it in GitHub Desktop.
React.renderComponentToStringAndCSS
var MyComponent = React.createComponent({
render () {
return <div style={{ color: 'blue' }}>Hello World</div>;
});
var page = React.renderComponentToStringAndCSS(MyComponent);
// value of page:
page = {
html: '<div className="__a" data-reactid=".abc" data-react-checksum="123" data-react-classname="__a">Hello World</div>',
css: {
__a: 'color:blue;'
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment