Skip to content

Instantly share code, notes, and snippets.

@jimthedev
Last active February 6, 2020 16:39
Show Gist options
  • Save jimthedev/99ea173d27db2a97ff739e28c8bbf349 to your computer and use it in GitHub Desktop.
Save jimthedev/99ea173d27db2a97ff739e28c8bbf349 to your computer and use it in GitHub Desktop.
load-latest-react
// Make sure you have an html element with an id of root and thewn you can run this. r is react, d is react-dom
Promise.all([
import(
"https://cdn.jsdelivr.net/npm/@esm-bundle/react-dom/esm/react-dom.resolved.production.min.js"
),
import(
"https://cdn.jsdelivr.net/npm/@esm-bundle/react/esm/react.production.min.js"
)
]).then(([{ default: d }, { default: r }]) =>
d.render(
r.createElement("div", null, "Hello, React"),
document.getElementById("root")
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment