Files
react/shells/dev/app/DeeplyNestedComponents/index.js
Brian Vaughn aa87b125e7 Lots of tweaks
Remove selected guideline in favor of background color for selected subtree.
Add badges in grid format to selected elements prop panel.
Show badges beside owners list.
2019-06-01 08:24:24 -07:00

36 lines
672 B
JavaScript

// @flow
import React, { Fragment } from 'react';
function wrapWithHoc(Component, index) {
function HOC() {
return <Component />;
}
HOC.displayName = `withHoc${index}(${Component.displayName ||
Component.name})`;
return HOC;
}
function wrapWithNested(Component, times) {
for (let i = 0; i < times; i++) {
Component = wrapWithHoc(Component, i);
}
return Component;
}
function Nested() {
return <div>Deeply nested div</div>;
}
const DeeplyNested = wrapWithNested(Nested, 100);
export default function DeeplyNestedComponents() {
return (
<Fragment>
<h1>Deeply nested component</h1>
<DeeplyNested />
</Fragment>
);
}