« React + Vite + TS » : différence entre les versions

De Banane Atomic
Aller à la navigationAller à la recherche
Ligne 10 : Ligne 10 :
     <script type="module" src="/dist/index.js"></script>
     <script type="module" src="/dist/index.js"></script>
</body>
</body>
</filebox>
<filebox fn='index.jsx'>
import React from 'react';
import ReactDOM from 'react-dom';
ReactDOM.render(
    <h1>Hello, world!</h1>,
    document.getElementById('app')
);
</filebox>
</filebox>

Version du 25 octobre 2024 à 21:01

Links

Exemple

index.html
<body>
    <!-- hosts the React application -->
    <div id="app"></div>
    <!-- import index.js generated from index.jsx by a bundler such as Snowpack -->
    <script type="module" src="/dist/index.js"></script>
</body>
index.jsx
import React from 'react';
import ReactDOM from 'react-dom';

ReactDOM.render(
    <h1>Hello, world!</h1>,
    document.getElementById('app')
);