-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.html
More file actions
41 lines (32 loc) · 1.33 KB
/
index.html
File metadata and controls
41 lines (32 loc) · 1.33 KB
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
33
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<html lang="en">
<title>myPage</title>
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<!-- <script crossorigin src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script> -->
<!-- <script crossorigin src="https://unpkg.com/babel-standalone@latest/babel.min.js"></script> -->
<script crossorigin src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script src="../build/stringToReactComponent.umd.js"></script>
<body>
<div id="root"></div>
<script type="text/babel">
const StringToReactComponent = window.StringToReactComponent?.default||window.StringToReactComponent;
const Welcome = function Welcome(props) {
return (<StringToReactComponent>
{`(props)=>{
const {useState}=React;
const [counter,setCounter]=useState(0);
const increase=()=>{
setCounter(counter+1);
};
return (<div>
<button onClick={increase}>+</button>
<span>{'counter : '+ counter}</span>
</div>);
}`}
</StringToReactComponent>);
};
ReactDOM.render(<Welcome />, document.getElementById('root'));
</script>
</body>
</html>