■ HTML / JSP
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script src="https://fb.me/react-15.1.0.js"></script>
<script src="https://fb.me/react-dom-15.1.0.js"></script>
<div id="root"></div>
</body>
</html>
■ JS(ES6 / Babel)
class Codelab extends React.Component{
render() {
let text = 'Hello React.js';
let style= {
backgroundColor:'aqua'
};
return (
<div style={style}>{text}</div>
);
}
}
class App extends React.Component {
render() {
return (
<Codelab/>
);
}
}
ReactDOM.render(<App/>, document.getElementById('root'));
'Developer > React.js' 카테고리의 다른 글
[Tutorial] State (0) | 2018.01.22 |
---|---|
[Tutorial] Props (0) | 2018.01.22 |