Skip to content

Instantly share code, notes, and snippets.

@apaleslimghost
Last active May 27, 2020 20:01
Show Gist options
  • Save apaleslimghost/144d03429a22595aa24247f8e4963289 to your computer and use it in GitHub Desktop.
Save apaleslimghost/144d03429a22595aa24247f8e4963289 to your computer and use it in GitHub Desktop.
name:@quarterto/styled-compose
const {createElement: h} = require('react')
module.exports = (...styles) => styles.reduce(
(prev, component) => {
function Composed(props) {
return h(component, Object.assign({}, props, {as: prev}))
}
Composed.displayName = component.displayName || component.name
return Composed
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment