Skip to content

Commit 38cf9ec

Browse files
committed
🔥 use React.Fragment instead of div
1 parent 0f65eb4 commit 38cf9ec

File tree

3 files changed

+9
-21
lines changed

3 files changed

+9
-21
lines changed

lib/generators/templates/component.es6.jsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
<%= file_header %>class <%= component_name %> extends React.Component {
22
render () {
3-
<% if attributes.size > 0 -%>
43
return (
5-
<div>
4+
<React.Fragment>
65
<% attributes.each do |attribute| -%>
7-
<div><%= attribute[:name].titleize %>: {this.props.<%= attribute[:name].camelize(:lower) %>}</div>
6+
<%= attribute[:name].titleize %>: {this.props.<%= attribute[:name].camelize(:lower) %>}
87
<% end -%>
9-
</div>
8+
</React.Fragment>
109
);
11-
<% else -%>
12-
return <div />;
13-
<% end -%>
1410
}
1511
}
1612

lib/generators/templates/component.js.jsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,13 @@
88
<% end -%>
99

1010
render: function() {
11-
<% if attributes.size > 0 -%>
1211
return (
13-
<div>
12+
<React.Fragment>
1413
<% attributes.each do |attribute| -%>
15-
<div><%= attribute[:name].titleize %>: {this.props.<%= attribute[:name].camelize(:lower) %>}</div>
14+
<%= attribute[:name].titleize %>: {this.props.<%= attribute[:name].camelize(:lower) %>}
1615
<% end -%>
17-
</div>
16+
</React.Fragment>
1817
);
19-
<% else -%>
20-
return <div />;
21-
<% end -%>
2218
}
2319
});
2420
<%= file_footer %>

lib/generators/templates/component.js.jsx.coffee

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,9 @@
77

88
<% end -%>
99
render: ->
10-
<% if attributes.size > 0 -%>
11-
`<div>
10+
`<React.Fragment>
1211
<% attributes.each do |attribute| -%>
13-
<div><%= attribute[:name].titleize %>: {this.props.<%= attribute[:name].camelize(:lower) %>}</div>
14-
<% end -%>
15-
</div>`
16-
<% else -%>
17-
`<div />`
12+
<%= attribute[:name].titleize %>: {this.props.<%= attribute[:name].camelize(:lower) %>}
1813
<% end -%>
14+
</React.Fragment>`
1915
<%= file_footer %>

0 commit comments

Comments
 (0)