Skip to content

Instantly share code, notes, and snippets.

@asm-jaime
Created February 13, 2020 15:13
Show Gist options
  • Save asm-jaime/221cc25b4db52c965291499f4b682530 to your computer and use it in GitHub Desktop.
Save asm-jaime/221cc25b4db52c965291499f4b682530 to your computer and use it in GitHub Desktop.
button, open json data in new tab
<button onClick={() => {
const jsonData = JSON.stringify(state, null, 2);
const w = window.open();
w.document.open();
w.document.write('<html><body><pre>' + jsonData + '</pre></body></html>');
w.document.close();
}}>open</button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment