最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - My React code is not showing in the browser with Vite - Stack Overflow

programmeradmin4浏览0评论

My code is not showing. I have a Vite site and my .html and .css work correctly but my .jsx is not showing. When I inspect the page something weird appears:

code when I open inspection

My HTML file however is:

<html>
    <head>
        <link rel="preconnect" href=";>
        <link rel="preconnect" href="; crossorigin>
        <link href=":ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap" rel="stylesheet">
        <link rel="stylesheet" href="/index.css">
    </head>
    <body>
        <div id="root"></div>
        <script src="./src/index.jsx" type="module"></script>
    </body>
</html>

and the index.jsx is:

import ReactDOM from 'react-dom/client';

ReactDOM.createRoot(document.getElementById('root')).render(<h1>Hello</h1>);
发布评论

评论列表(0)

  1. 暂无评论