Quick actions

cmd+k|ctrl+k

Navigation

Languages

!React.createElement

Snippet info

Language

JavaScript

Visibility

public

Author

paulkotov

Created

2021-03-16T20:54:26.621343Z

Updated

2025-04-25T21:58:44.609401Z

const React = {
    createElement: (type, config, ...children) => {
        const key = config ? (config.key || null) : null;
        const props = config || {};
        
        if (children.length === 1) {
            props.children = children[0];
        } else {
            props.children = children;
        }
        
        return {
            type,
            key,
            props
        };
    }
};
INFO