Reputation: 415
What is the standard style for jsx? Specifically when HTML is intertwined with js. Are the parenthesis after return in the correct spot? Anyone know of any good formatters that don't mess everything up?
render: function(){
return (
<li>
<input id={this.props.id} type="checkbox" />
<label htmlFor={this.props.id}>{this.props.tag}</label>
</li>
);
}
Upvotes: 5
Views: 5916
Reputation: 415
Found a good style guide here https://github.com/airbnb/javascript/blob/master/react/README.md
Upvotes: 2
Reputation: 2852
I like to use Airbnb code style with Web Storm Editor provide good support for jsx syntax.
Note: you can apply Airbnb style automatically inside Web Storm from Settings->Code Quality
render() {
return (
<MyComponent className="long body" foo="bar">
<MyChild />
</MyComponent>
);
}
Upvotes: 6