Skip to content

Instantly share code, notes, and snippets.

@geelen
Created March 27, 2017 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geelen/6aba780bb1d90a19a7fc1015c876d916 to your computer and use it in GitHub Desktop.
Save geelen/6aba780bb1d90a19a7fc1015c876d916 to your computer and use it in GitHub Desktop.
import React from 'react'
const cm2sc = names => Object.keys(names).reduce((comps, name) => (
{ ...comps, [name]: ({is = 'div', className, ...props}) => (
React.createElement(is, { ...props, className: [names[name], className].filter(_=>_).join(' ') })
) }
), {})
export default cm2sc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment