jsonml-to-react-element
To convert JsonML to React Component.
Installation
npm install --save jsonml-to-react-element
Usage
Basic:
const ReactDOM = ;const toReactElement = ; const title = 'h1' 'Hello world!'; ReactDOM;
With converters:
const React = ;const ReactDOM = ;const toReactElement = ; const website = 'section' 'header' ... 'article' 'h1' 'Hello world!' 'footer' ... ; const html5to4 = 'section' 'header' 'article' 'footer' > -1 React ...; ReactDOM;
API
toReactElement(jsonml: Object [, converters: Array]): React.Component
To convert JsonML to React Component with converters.
converters: Array[Pair[Function, Function]]
Converters which are passed to toReactElement
will concat with default converters. It works like switch
sentence.
Each item in converters is a pair of functions. The first function is a prediction, and the second function is a processor which take JsonML node and return React Component.
Relative
jsonml.js A collection of JsonML tools.
Liscence
MIT