Home

Awesome

json-to-react-element

install

example

var toElement = require('json-to-react-element');

var MyUl = function() {
  return toElement({
    children: [{
      name: 'li',
      props: {
        key: 'my-li'
      },
      content: 3
    }],
    name: 'ul',
    id: '.0'
  });
};

is equivalent to:

var MyUl = function() {
  return (<ul>
    <li key='my-key'>3</li>
  </ul>);
};

license

BSD-3-Clause