Skip to content

Instantly share code, notes, and snippets.

@rexxars
Last active December 19, 2019 05:22
Show Gist options
  • Save rexxars/877ff04273fdf28793a4 to your computer and use it in GitHub Desktop.
Save rexxars/877ff04273fdf28793a4 to your computer and use it in GitHub Desktop.
React JSON dump component
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