Skip to content

Instantly share code, notes, and snippets.

@kabinpokhrel
Created January 28, 2022 15:28
Show Gist options
  • Save kabinpokhrel/aa88e3b96888822eaf01658a3a919401 to your computer and use it in GitHub Desktop.
Save kabinpokhrel/aa88e3b96888822eaf01658a3a919401 to your computer and use it in GitHub Desktop.
Simple Json Formatter in ReactJs with Tailwind CSS
/*
* USAGE: <DebugJson data={{"hello": "hello world!"}} />
*/
import React from 'react';
const DebugJson = ({data}) => {
return (
<pre className={"mt-2 p-2 overflow-x-auto whitespace-pre-wrap break-words"}>
<code className={"text-blue-600 text-xl"}>
{JSON.stringify(data, undefined, 2)}
</code>
</pre>
);
};
export default DebugJson;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment