function elem(type, config = {}) {

    const {omit, item, items, ...props} = config;

    // 1) Convenience omission syntax.
    if (omit) return null;

    // 2) Read children from item[s] config.
    const itemConfig = item ?? items,
        children = (isNil(itemConfig) ? [] : castArray(itemConfig));

    // 3) Recapture API props that needed '$' prefix to avoid conflicts.
    ['$omit', '$item', '$items'].forEach(key => {
        if (props.hasOwnProperty(key)) {
            props[key.substring(1)] = props[key];
            delete props[key];
        }
    });

    return createElement(type, props, ...children);
}
/**
 * Convenience method for creating React Elements. This method is designed to provide a well-
 * formatted, declarative, native javascript approach to configuring Elements and their children.
 * It serves as an alternative to JSX and is especially useful for code-heavy element trees.
 * (For element trees with a significant amount of hypertext, JSX could be a better choice.)
 *
 * This function is a *very* thin layer around `React.createElement()`. The core enhancement is that
 * it expects child elements and props to be specified in a single bundle, with children placed
 * within an `item` or `items` key. This allows developers to write declarative, multi-level element
 * trees in a concise yet highly-readable style.
 *
 * An additional minor-but-useful feature is support for an `omit` config, which allows element
 * subtrees to be declaratively excluded from rendering if a given condition is met.
 *
 * Note that if a React Component has its own property of `item`, `items`, or `omit`, the property
 * must be specified with a `$` prefix (e.g. `$item`) to avoid conflicting with the elem() API.
 *
 * @param {(Object|string)} type - class extending Component or string representing an HTML element.
 * @param {Object} [config] - Element configuration.
 * @param {(Array|Element|string)} [config.items] - child Element(s).
 * @param {(Element|string)} [config.item] - equivalent to `items`, offered for code clarity when
 *      only one child is needed.
 * @param {boolean} [config.omit] - true to exclude the Element by returning null.
 * @param {*} [config ...props] - props to apply to the Element.
 * @return ReactElement
 */
Convenience method for creating React Elements. This method is designed to provide a well
formatted, declarative, native javascript approach to configuring Elements and their children.
It serves as an alternative to JSX and is especially useful for code-heavy element trees.
(For element trees with a significant amount of hypertext, JSX could be a better choice.)

This function is a *very* thin layer around `React.createElement()`. The core enhancement is that
it expects child elements and props to be specified in a single bundle, with children placed
within an `item` or `items` key. This allows developers to write declarative, multi-level element
trees in a concise yet highly-readable style.

An additional minor-but-useful feature is support for an `omit` config, which allows element
subtrees to be declaratively excluded from rendering if a given condition is met.



@param {(Object|string)} type - class extending Component or string representing an HTML element.
@param {Object} [config] - Element configuration.
Convenience method for creating React Elements . This method is designed to provide a well formatted declarative native javascript approach to configuring Elements and their children . It serves as an alternative to JSX and is especially useful for code - heavy element trees . ( For element trees with a significant amount of hypertext JSX could be a better choice . ) This function is a * very * thin layer around ` React . createElement () ` . The core enhancement is that it expects child elements and props to be specified in a single bundle with children placed within an ` item ` or ` items ` key . This allows developers to write declarative multi - level element trees in a concise yet highly - readable style . An additional minor - but - useful feature is support for an ` omit ` config which allows element subtrees to be declaratively excluded from rendering if a given condition is met . @param { ( Object|string ) } type - class extending Component or string representing an HTML element . @param { Object } [ config ] - Element configuration .
function elem(type, config = {}) {
    const {omit, item, items, ...props} = config;
    if (omit) return null;
    const itemConfig = item ?? items,
        children = (isNil(itemConfig) ? [] : castArray(itemConfig));
    ['$omit', '$item', '$items'].forEach(key => {
        if (props.hasOwnProperty(key)) {
            props[key.substring(1)] = props[key];
            delete props[key];
        }
    });
    return createElement(type, props, ...children);
}
function elem ( type , config = { } ) { const { omit , item , items , ... props } = config ; if ( omit ) return null ; const itemConfig = item ?? items , children = ( isNil ( itemConfig ) ? [ ] : castArray ( itemConfig ) ) ; [ '$omit' , '$item' , '$items' ] . forEach ( key => { if ( props . hasOwnProperty ( key ) ) { props [ key . substring ( 1 ) ] = props [ key ] ; delete props [ key ] ; } } ) ; return createElement ( type , props , ... children ) ; }
Convenience method for creating React Elements.
Convenience method for creating React Elements .
// 1) Convenience omission syntax. // 2) Read children from item[s] config. // 3) Recapture API props that needed '$' prefix to avoid conflicts.