Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including react-domify with all npm packages installed. Try it out:

require("react/package.json"); // react is a peer dependency. var reactDomify = require("react-domify")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

react-domify v0.2.6

React Domify

React DOMify

Like JSON.strinfigy but uses React.js to generate DOM elements.

Demo & Examples

Live demo: JedWatson.github.io/react-domify

To build the examples locally, run:

npm install
gulp dev

Then open localhost:8000 in a browser.

Installation

The easiest way to use react-domify is to install it from NPM and include it in your own React build process (using Browserify, Webpack, etc).

You can also use the standalone build by including dist/react-domify.js in your page. If you use this, make sure you have already included React, and it is available as a global variable.

npm install react-domify --save

Usage

Provide the variable to render as the value property.

var DOMify = require('react-domify');

var data = {
  str: 'It formats strings, numbers, booleans and dates',
  bool: true,
  date: new Date(),
  num: 42,
  arr: [
    'And nested arrays / objects',
    {
      key: 'value'
    }
  ]
};

<DOMify value={data} />

License

MIT. Copyright (c) 2016 Jed Watson.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free