|
1 | 1 | <!DOCTYPE html> |
2 | | -<html> |
| 2 | +<html lang="en"> |
3 | 3 | <head> |
4 | | - <meta charset="UTF-8" /> |
| 4 | + <meta charset="UTF-8"> |
5 | 5 | <title>Hello World</title> |
6 | | - <script src="https://unpkg.com/react@18/umd/react.development.js"></script> |
7 | | - <script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script> |
| 6 | + <script src="https://unpkg.com/react@18.3.1/umd/react.development.js"></script> |
| 7 | + <script src="https://unpkg.com/react-dom@18.3.1/umd/react-dom.development.js"></script> |
8 | 8 |
|
9 | | - <!-- Don't use this in production—do this: https://reactjs.org/docs/add-react-to-a-website#add-jsx-to-a-project --> |
10 | | - <script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script> |
| 9 | + <!-- Don't use this in production: --> |
| 10 | + <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script> |
11 | 11 | </head> |
12 | 12 | <body> |
13 | 13 | <div id="root"></div> |
14 | 14 | <script type="text/babel"> |
15 | 15 |
|
16 | | - ReactDOM.render( |
17 | | - <h1>Hello, world!</h1>, |
18 | | - document.getElementById('root') |
19 | | - ); |
| 16 | + function MyApp() { |
| 17 | + return <h1>Hello, world!</h1>; |
| 18 | + } |
| 19 | + |
| 20 | + const container = document.getElementById('root'); |
| 21 | + const root = ReactDOM.createRoot(container); |
| 22 | + root.render(<MyApp />); |
20 | 23 |
|
21 | 24 | </script> |
22 | 25 | <!-- |
23 | 26 | Note: this page is a great way to try React but it's not suitable for production. |
24 | 27 | It slowly compiles JSX with Babel in the browser and uses a large development build of React. |
25 | 28 |
|
26 | | - Read this section for a production-ready setup with JSX: |
27 | | - https://reactjs.org/docs/docs/add-react-to-a-website#try-react-with-jsx |
28 | | -
|
29 | | - In a larger project, you can use an integrated toolchain that includes JSX instead: |
30 | | - https://reactjs.org/docs/start-a-new-react-project |
| 29 | + Read this page for starting a new React project with JSX: |
| 30 | + https://react.dev/learn/start-a-new-react-project |
31 | 31 |
|
32 | | - You can also use React without JSX, in which case you can remove Babel: |
33 | | - https://reactjs.org/docs/add-react-to-a-website#add-react-in-one-minute |
| 32 | + Read this page for adding React with JSX to an existing project: |
| 33 | + https://react.dev/learn/add-react-to-an-existing-project |
34 | 34 | --> |
35 | 35 | </body> |
36 | 36 | </html> |
0 commit comments