Skip to content

Instantly share code, notes, and snippets.

@netsi1964
Last active November 10, 2016 13:04
Show Gist options
  • Save netsi1964/91f4d484efe513505d28bbfdf20eaa64 to your computer and use it in GitHub Desktop.
Save netsi1964/91f4d484efe513505d28bbfdf20eaa64 to your computer and use it in GitHub Desktop.
Function to get cleaned HTML from generated React HTML (for Chrome console)
function cleanReactHTML(html) {
var result = html.replace(/data-reactid="[\.\d:\D]{1,23}"/g,'');
result = result.replace(/data-reactroot="[\.\d:\D]{1,23}"/g,'');
result = result.replace(/<!--[\s\S]*?-->/g,'');
return result
}
copy(cleanReactHTML(document.querySelector('.app').innerHTML));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment