-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcarros.html
52 lines (43 loc) · 1.44 KB
/
carros.html
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
42
43
44
45
46
47
48
49
50
51
52
<html>
<head>
<meta charset="UTF-8" />
<title>Hello React!</title>
<link rel="stylesheet" type="text/css" href="test.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.24.0/babel.js"></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js'></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
</head>
<body>
<div id="carros"></div>
<div id="nome"></div>
<script type="text/babel">
var carros = ['Cruze','Fusion','Civic', 'Elantra','Gol', 'Jetta'];
ReactDOM.render(
<div>
{
//código javascript
carros.map(function (carro) {
return <li>{carro}</li>
})
//fim código
}
</div>,
/* passando o objeto */
document.getElementById('carros')
);
//classe passando parametros.
class Hello extends React.Component{
render(){
return(
<h1>Olá meu nome é {this.props.nome}!!!!!!</h1>
);
}
}
ReactDOM.render(
<Hello nome='Alexandre'/>,
document.getElementById('nome')
);
</script>
</body>
</html>