question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Upgrade to React 16 - Region without empty DIV

See original GitHub issue

The 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:open
  • Created 6 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
fahadsuhaibcommented, Nov 9, 2017

@fahad19 Sure, that sounds fine, I’ll just fork for now.

1reaction
mAiNiNfEcTiOncommented, Nov 9, 2017

@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.:

<style>
  .my-custom-class {
    border: solid 1 px black;
    border-radius: 5px;
  }
</style>

<Region className="my-custom-class" name="my-custom-name"/>

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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found