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.

Dump An Object In React

Use this snippet:

Code

return (
    <div>
        <pre>{JSON.stringify(someObject, null, 2)}</pre>
    </div>
)

To replace this:

Code

return (
    <div>
        {someData}
    </div>
)

When you get errors like:

Code

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

Call Stack
throwOnInvalidObjectType