Upgrade to React 16 - Region without empty DIV
See original GitHub issueThe below code block in region.js is not required in React 16, it could be simply returned as a listForRendering.map, React 16 considers array rendering as well and that helps in minimizing bloated HTML.
return _react2.default.createElement(
'div',
null,
listForRendering.map(function (item) {
var Component = item.Component,
name = item.name;
return _react2.default.createElement(Component, { key: 'app-' + name });
})
);
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
DOM Attributes in React 16
With React 16, you can now pass custom attributes to all HTML and SVG elements, and React doesn't have to include the whole...
Read more >Journey from React 15 to React 16 | by Akash Verma - Medium
Move to prop-types package from React.PropTypes. You can use the Facebook codemod to move or do it manually if this is not a...
Read more >How to return an empty jsx element from the render function in ...
Just in case anyone want another approach: Since React v16.2 you can use Fragments allowing to add an empty JSX tag like this:...
Read more >How to Use One Component to Render Many HTML ...
In order to do this, wrap it inside a parent div which essentially makes it a single DOM node with multiple elements inside...
Read more >How To Manage State on React Class Components
To update state , React developers use a special method called setState that is inherited from the base Component class. The setState method ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@fahad19 Sure, that sounds fine, I’ll just fork for now.
@fahadsuhaib I understand your point of view. However, what I’m trying to say is that this is a breaking change.
Users that have been using the
Region
component are expecting that a<div>
element comes out when rendering AND that they can pass a className as an attribute to that component and it will be used in the wrapper element rendered.E.g.:
In the current state, this would output a
<div class="my-custom-class"><!-- Frint Apps here --></div>
With the changes proposed, it would be just
<!-- Frint Apps here -->
.If I update to the new way, the styles on the
<style>
would not be used anymore.Last but not the least, I’m not against implementing it, but that is a breaking change which implies a new major. Also it means that FrintJS requires React 16 as a minimum. That means that for deprecation and/or migration periods you don’t support previous versions of React.
Bold move, no?