Skip to content

Instantly share code, notes, and snippets.

@zaydek
Created May 20, 2020 18:36
Show Gist options
  • Save zaydek/94be1995c1ed4a46c0fd366e626ce964 to your computer and use it in GitHub Desktop.
Save zaydek/94be1995c1ed4a46c0fd366e626ce964 to your computer and use it in GitHub Desktop.
import React from "react"
import ReactDOM from "react-dom"
// https://stackoverflow.com/a/33292942
function timeout(timeoutMs) {
return new Promise(resolve => setTimeout(resolve, timeoutMs))
}
;(async () => {
const root = document.getElementById("root")
ReactDOM.render(
<div>
hello, world!
</div>,
root,
)
await timeout(1e3)
root.children[0].innerHTML = "lol"
await timeout(1e3)
ReactDOM.render(
<div>
hello, world! 2
</div>,
root,
)
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment