【发布时间】:2016-02-25 08:41:33
【问题描述】:
我正在阅读“React Native for iOS Development”这本书来学习没有任何 react.js 经验的 react native 开发。 一些代码让我困惑了一段时间,评论后的代码:
var App = React.createClass({
render: function() {
// why there is this line and what does 'this' in the line stand for?
var txt = this.props.txt
return (
<div>
<h1>{myProp}</h1>
</div>
);
},
});
React.render(
<App myProp='Hi from prop' />, document.getElementById('container'));
这是整个 js 文件,它将从一个 html 文件中引用,其中有一个 id="container" 属性的 div 标签。而已。 任何帮助将不胜感激。
【问题讨论】:
标签: javascript reactjs react-native