-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtest-react.html
More file actions
32 lines (28 loc) · 985 Bytes
/
test-react.html
File metadata and controls
32 lines (28 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE html>
<html>
<head>
<title>React Test</title>
<script crossorigin src="https://unpkg.com/react@17/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.development.js"></script>
</head>
<body>
<div id="root"></div>
<script>
console.log('React available:', typeof React);
console.log('ReactDOM available:', typeof ReactDOM);
const { useState } = React;
const e = React.createElement;
function TestApp() {
const [count, setCount] = useState(0);
return e('div', null,
e('h1', null, 'React Test'),
e('p', null, 'Count: ', count),
e('button', {
onClick: () => setCount(count + 1)
}, 'Increment')
);
}
ReactDOM.render(e(TestApp), document.getElementById('root'));
</script>
</body>
</html>