Skip to content

jutaz/render-primitive

Repository files navigation

render-primitive

Renders JS primitives as text in React

NPM JavaScript Style Guide

Install

npm install --save render-primitive

Usage

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>
    )
  }
}

License

MIT © jutaz

Releases

No releases published

Packages

No packages published