Skip to content

Instantly share code, notes, and snippets.

@johnpolacek
Created February 22, 2024 22:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnpolacek/1266f534a4b3559b14af65029bc1fc80 to your computer and use it in GitHub Desktop.
Save johnpolacek/1266f534a4b3559b14af65029bc1fc80 to your computer and use it in GitHub Desktop.
Utility React Tailwind Component for printing an object to the screen for building and debugging
import React from "react"
const PrintObject: React.FC<{ object: Record<string, unknown> }> = ({ object }) => {
return (
<pre className="w-full max-w-5xl overflow-scroll text-sm border bg-black text-white rounded p-2 ">
<code>{JSON.stringify(object, null, 2)}</code>
</pre>
)
}
export default PrintObject
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment