rpominov / react-demo

A React-component for creating demos of other components
MIT License
99 stars 9 forks source link

Truncating JSON not always a good idea #10

Open rpominov opened 9 years ago

rpominov commented 9 years ago

Currently we truncate long values when stringify them to JSON (see https://github.com/rpominov/react-demo/blob/119f517adffd00ab34415339e4cbd79ca1ce51fd/src/stringify.js#L9-15)

Perhaps it's not always a good idea, for example in callback logs we might want to see the whole object no matter how big it is.

Not sure yet how to address this issue better, maybe we should add an option somewhere or maybe there is a better solution.

rpominov commented 9 years ago

Perhaps we should not truncate in logs if map function is used — user customizes the log, so they are responsible to truncate the value in this case. Or maybe not, auto truncating may be convenient in this case too.

rpominov commented 9 years ago

Another idea: ability to expand truncated object (on click or hover)

rpominov commented 9 years ago

We should consider using some of those:

https://github.com/xyc/react-object-inspector https://github.com/chibicode/react-json-tree