Transform JSX to incremental DOM with Babel
Install
$ npm i jsxidom --save-dev
In .babelrc
"plugins": [
["transform-react-jsx", { "pragma": "jsxidom" }]
]
In application
require('jsxidom');
The above line is required once. In addition to building incremental DOM from JSX, it provides a render method to HTML element.
Example use case
const app = document.body.querySelector('#app')
let i = 0
function refresh() {
app.render(<div class="counter">{ i++ }</div>)
}
refresh()
setInterval( refresh, 1000 )