Note: This site is currently "Under construction". I'm migrating to a new version of my site building software. Lots of things are in a state of disrepair as a result (for example, footnote links aren't working). It's all part of the process of building in public. Most things should still be readable though.

Print Out An Object In React With JSONstringify

TODO: Fix the formatting of this post that got busted during the move to nextjs

Code

If you get this when you're trying to print out an object with something like:

``jsx
<div>{exampleObject}</div>
``

Error: Objects are not valid as a React child (found: object with keys {example_keys}). If you meant to render a collection of children, use an array instead.

Use this:

``jsx
<div>{JSON.stringify(exampleObject)}</div>
``