/react-merge-props-and-styles

react utility to merge multiple props with respect to class names and styles

Primary LanguageJavaScriptMIT LicenseMIT

How to use

const propsA = {
  className: 'classA',
  style: { cursor: 'pointer' },
  big: true,
};

const propsB = {
  className: 'classB',
  style: { display: 'block' },
  strong: true,
};

const propsC = {
  style: { display: 'none' },
};

merge(propsA, propsB, propsC);

The result

const result = {
  className: 'classA classB',
  style: {
    cursor: 'pointer',
    display: 'none',
  },
  big: true,
  strong: true,
}