react-json-syntax

Alternative syntax for React.js

Usage no npm install needed!

<script type="module">
  import reactJsonSyntax from 'https://cdn.skypack.dev/react-json-syntax';
</script>

README

react-json-syntax

An alternative syntax for React.js templates.

NPM

API

usage:

const reactParse = require('react-json-syntax');
return (
  <tag attribute="value">
    text
    <child>
        { this.state.value }
    </child>
  </tag>
);

is the simular as

return reactParse(
    ['tag', {'attribute': 'value'}, [
        'text',
        ['child', [
            this.state.value
        ]]
    ]]
);

alias:

return React.parse(
    ['div', [
        'text',
        [MyComponent, {myProp: 123}]
    ]]
);