Created
January 28, 2022 15:28
-
-
Save kabinpokhrel/aa88e3b96888822eaf01658a3a919401 to your computer and use it in GitHub Desktop.
Simple Json Formatter in ReactJs with Tailwind CSS
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
/* | |
* 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