react in cdn

index.html:

<!doctype html>
<html>

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <title>Ariakit</title>
</head>

<body>
    <div id="root"></div>
    <!-- Babel -->
    <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
    <!-- Usage -->
    <script type="text/babel" data-type="module">
        import * as React from "https://esm.sh/react";
        import { createRoot } from "https://esm.sh/react-dom";
        import { Button } from "https://esm.sh/@ariakit/react";

        function App() {
            return <Button onClick={() => { alert("clicked") }}>Button</Button>;
        }

        createRoot(document.getElementById("root")).render(<App />);
    </script>
</body>

</html>
posted @ 2024-08-15 08:43  卓能文  阅读(20)  评论(0)    收藏  举报