« React + Vite + TS » : différence entre les versions
Apparence
Ligne 3 : | Ligne 3 : | ||
= Exemple = | = Exemple = | ||
<filebox fn='index.html'> | <filebox fn='public/index.html'> | ||
<body> | <body> | ||
<!-- hosts the React application --> | <!-- hosts the React application --> | ||
Ligne 12 : | Ligne 12 : | ||
</filebox> | </filebox> | ||
<filebox fn='index.jsx'> | <filebox fn='src/index.jsx'> | ||
import React from 'react'; | import React from 'react'; | ||
import ReactDOM from 'react-dom'; | import ReactDOM from 'react-dom'; |
Version du 25 octobre 2024 à 21:01
Links
Exemple
public/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>
|
src/index.jsx |
import React from 'react';
import ReactDOM from 'react-dom';
ReactDOM.render(
<h1>Hello, world!</h1>,
document.getElementById('app')
);
|