react-simple-json-viewer
Version:
A basic lightweight React component for viewing data in an expandable way.
21 lines (15 loc) • 449 B
JavaScript
import React from 'react'
import ObjectType from './object'
import ValueType from './value'
import ArrayType from './array'
const Type = props => {
const { value, ...rest } = props
if (Array.isArray(value)) {
return <ArrayType value={value} {...rest} />
}
if (typeof value === 'object') {
return <ObjectType value={value} {...rest} />
}
return <ValueType value={value} {...rest} />
}
export default Type