How to view rendered HTML of React component inside JavaScript console

Assume you have defined a React component that has a render function and assign it to variable someReactComponent.

Then you can view the rendered version of the React component inside the JavaScript console by doing the following:

var someReactComponent = React.createClass({...});

console.log("HTML for someReactComponent is :" + React.renderComponentToString(someReactComponent));
VN:F [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)
How to view rendered HTML of React component inside JavaScript console, 5.0 out of 5 based on 1 rating
Facebook Twitter Email

Leave a Reply