Created
March 27, 2017 23:23
-
-
Save geelen/6aba780bb1d90a19a7fc1015c876d916 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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