Last active
January 12, 2017 00:11
-
-
Save tbranyen/48c0f4c1aa8bdddcbf63ace4d27e2fd2 to your computer and use it in GitHub Desktop.
diffHTML working out-of-the-box with JSX
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 { createTree, innerHTML } from 'diffhtml'; | |
class Display { | |
render({ message, children }) { | |
return [ | |
<li>{message}</li>, | |
...children, | |
]; | |
} | |
} | |
const App = state => ( | |
<ul> | |
<Display {...state}> | |
<li><b>Test</b></li> | |
</Display> | |
</ul> | |
); | |
innerHTML(document.body, <App message="Hello world" />); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment