以React.js文档中的此示例为例
var Avatar = React.createClass({
render: function() {
return (
<div>
<ProfilePic username={this.props.username} />
<ProfileLink username={this.props.username} />
</div>
);
}
});
var ProfilePic = React.createClass({
render: function() {
return (
<img src={'http://graph.facebook.com/' + this.props.username + '/picture'} />
);
}
});
var ProfileLink = React.createClass({
render: function() {
return (
<a href={'http://www.facebook.com/' + this.props.username}>
{this.props.username}
</a>
);
}
});
React.render(
<Avatar username="pwh" />,
document.getElementById('example')
);
Run Code Online (Sandbox Code Playgroud)
对于这样的情况,组件没有状态,如果我不打算使用jsx:是否有任何缺点(性能或其他方面)只使用函数而不是创建组件?IE,将它减少到这样的东西(用ES6编写)
var { a, div, img } = React.DOM;
var Avatar = …Run Code Online (Sandbox Code Playgroud) 在VSCode中,我试图将sjson模式添加到我拥有的项目中。我的.vscode/settings.json文件是这样的:
{
"json.schemas": [
{
"fileMatch": [
"/*.json"
],
"url": "https://path/to/url.json"
}
]
}
Run Code Online (Sandbox Code Playgroud)
```
这可行,但是当前正在应用到项目中所有文件夹中的所有.json文件,我不需要。我希望它仅适用于根目录中的所有.json文件。我必须在该fileMatch属性中添加什么才能启用此功能?
尝试了以下方法。这些工作,但适用于每个.json文件:
"/*.json""*.json"这些根本不起作用(没有.json文件获取架构):
"${workspaceFolder}/*.json""${workspaceFolder}*.json""${workspaceFolder}\\*.json"{}workspaceRoot