react-component-list

React Component List Component

Usage no npm install needed!

<script type="module">
  import reactComponentList from 'https://cdn.skypack.dev/react-component-list';
</script>

README

React-Component-List

Code Climate Build Status

Usage:

import React, {PropTypes} from 'react';
import {renderToStaticMarkup} from 'react-dom/server';
import createList from 'react-component-list';

const Wrapper = ({children}) => <ul>{children}</ul>;
Wrapper.propTypes = { children: PropTypes.node.isRequired };

const ComponentList = createList(Wrapper);
ComponentList.push(<li>{'abc'}</li>);
ComponentList.push(<li>{'def'}</li>);
ComponentList.push(<li>{'ghi'}</li>);

renderToStaticMarkup(<ComponentList />);
/**
 *  <ul>
 *    <li>abc</li>
 *    <li>def</li>
 *    <li>ghi</li>
 *  </ul>
 */