Created
June 17, 2024 14:07
-
-
Save felher/647ed24eb392877a05f049cae206ca75 to your computer and use it in GitHub Desktop.
Create a react-icons icon from javascript only with no build tool
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
<script type="module"> | |
import React from "https://esm.sh/react@18/" | |
import ReactDOMClient from "https://esm.sh/react-dom@18/client" | |
import * as ReactIconsFa from "https://esm.sh/[email protected]/fa" | |
window.React = React | |
window.ReactDOM = ReactDOMClient | |
window.ReactIconsFa = ReactIconsFa | |
window.onReactStuffLoaded(); | |
</script> | |
</head> | |
<body> | |
<div id="anchor"></div> | |
<script> | |
window.onReactStuffLoaded = () => { | |
const anchor = document.getElementById("anchor") | |
const root = window.ReactDOM.createRoot(anchor) | |
root.render(window.React.createElement(window.ReactIconsFa.FaBeer)) | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment