Skip to content

Instantly share code, notes, and snippets.

import React from 'react';
export const createComponent = (rule, type = 'div', opts = {}) => {
const { omitProps = [] } = opts;
const FelaComponent = ({ children, className, injectRule, ...other }, { renderer, theme }) => {
let componentProps = other;
if (omitProps.length) {
componentProps = {};
const blacklist = new Set(omitProps); // Todo make performance test to evaluate if sets are faster
Object.keys(other).forEach(key => { if (!blacklist.has(key)) componentProps[key] = other[key]; });