1.3.2 • Published 7 years ago

reacon v1.3.2

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

Reacon - React component notation

Circle CI semantic-release

Use reacon to compile a plain json object into a composite React component.

npm install reacon

Examples

import { reactify, inflater } from 'reacon';

const inflate = inflater({
  inliners: [],
  modifiers: [],
});

const inflated = inflate([
  {
    type: 'modifier',
    props: {
      resource: 'A',
    },
  },
  {
    type: 'div',
    props: {
      children: {
        {
          type: 'p',
          props: {
            children: 'This is a paragraf',
          },
        },
        {
          type: 'p',
          props: {
            children: 'TEMPLATE Interpolate with ${value}',
          },
        },
      },
    },
  },
]);

const Component = reactify(inflated);

return <Component value="props" />;

Will produce the following:

<div>
  <p>This is a paragraph</p>
  <p>Interpolate with data and props</p>
</div>

reactify can also be extended with custom components.

const MyComponent = ({ arg }) => {
  return <div>{arg}</div>;
};

const injectable = reactify({
  component: 'MyComponent',
  arg: 'Hello',
}, { MyComponent });

Which will produce:

<div>Hello</div>
1.3.2

7 years ago

1.3.1

8 years ago

1.3.0

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago