[React] React Fundamentals: The Render Method
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>React Lesson 1: render method</title>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.12.2/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.12.2/JSXTransformer.js"></script>
<script type="text/jsx">
var React_app = React.createClass({
render: function() {
return (
<div>
<b>Should have (), if you have mutli tag in return, include them into a div</b>
<h1>Hello React World!</h1>
</div>
);
}
});
React.render(<React_app />, document.body);
</script>
</body>
</html>
When you write return in render function, better to put () there.
When you return multi-tags in return, include them into a single div / section ...

浙公网安备 33010602011771号