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: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
Facebook Twitter Email

Leave a Reply