React JSX风格指南
问题描述:
jsx的标准风格是什么?特别是当HTML与js交织在一起时。在正确的位置返回后括号是?任何人都知道任何优秀的格式化程序不会搞砸一切吗?React JSX风格指南
render: function(){
return (
<li>
<input id={this.props.id} type="checkbox" />
<label htmlFor={this.props.id}>{this.props.tag}</label>
</li>
);
}
答
我喜欢用Airbnb code style 与Web Storm Editor提供JSX语法很好的支持。
注:可以自动网络风暴中心从Settings->Code Quality
render() {
return (
<MyComponent className="long body" foo="bar">
<MyChild />
</MyComponent>
);
}