Skip to content

Instantly share code, notes, and snippets.

@alexkrolick
Created September 8, 2017 06:54
Show Gist options
  • Save alexkrolick/8e62fd0dc3630d847a5132d26bf3d408 to your computer and use it in GitHub Desktop.
Save alexkrolick/8e62fd0dc3630d847a5132d26bf3d408 to your computer and use it in GitHub Desktop.
import React, { Component, createElement as h } from 'react'
const Foo = ({text, ...props}) => h("span", props, text)
const Bar = props => h("div", {},
h(Foo, { ...props, style: "color: blue" })
)
class Baz extends Component {
constructor(props) {
super(props)
this.state = { text: 'Baz-text' }
}
render() {
return h(Bar, { text: this.state.text })
}
}
render(h(Baz), document.body)
<div>
<span style="color: blue;">
Baz-text
</span>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment