riot
Version:
Simple and elegant component-based UI library
25 lines (22 loc) • 809 B
JavaScript
/* Riot v10.1.2, @license MIT */
import { createPureComponent as createPureComponent$1 } from '../core/create-pure-component.js';
import { pure } from './pure.js';
/**
* Helper method to simplify the creation of pure components without the need to rely on a .riot file
* @param {Function} func - RiotPureComponent factory function
* @param {string} name - Optional parameter if you want to define the name of your component for debugging purposes
* @returns {import('../../riot.js').RiotComponentWrapper} pure component object implementation
*/
function createPureComponent(func, name) {
return {
name,
exports: pure(({ slots, attributes, props }) =>
createPureComponent$1(func, {
attributes,
slots,
props,
}),
),
}
}
export { createPureComponent };