Renders JS primitives as text in React
npm install --save render-primitive
import React, { Component } from 'react'
import RenderPrimitive from 'render-primitive'
class Example extends Component {
render () {
return (
<div>
{/* Basic usage */}
<RenderPrimitive>{true}</RenderPrimitive>
<RenderPrimitive>{false}</RenderPrimitive>
<RenderPrimitive>{undefined}</RenderPrimitive>
<RenderPrimitive>{null}</RenderPrimitive>
<RenderPrimitive>{123}</RenderPrimitive>
<RenderPrimitive>{new Symbol('foo')}</RenderPrimitive>
<RenderPrimitive>{'bar'}</RenderPrimitive>
{/* Prop shortcut */}
<RenderPrimitive value={false} />
</div>
)
}
}
MIT © jutaz