Dump An Object In React

September - 2021

Use this snippet:

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

To replace this:

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

When you get errors like:

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