Last active
December 19, 2019 05:22
-
-
Save rexxars/877ff04273fdf28793a4 to your computer and use it in GitHub Desktop.
React JSON dump component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
class JsonDump extends React.Component { | |
static propTypes = { | |
children: React.PropTypes.any | |
} | |
render() { | |
return <pre>{JSON.stringify(this.props.children, null, 4)}</pre> | |
} | |
} | |
// Usage: | |
<JsonDump>{someVar}</JsonDump> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment