I'm creating a react component of subcomponents with:
const Miniviews = ({reducedArry}) => {
Object.keys(reducedArry).map((applicationId) => {
return (
<div id={applicationId}>
{reducedArry[applicationId].map(miniview => (
<Miniview
key={miniview.id}
id={miniview.id}
title={miniview.name}
handleOpenButton={this.handleMiniviewOpenView}
/>)
)}
</div>
)
})
};
console.log(Miniviews);
and displaying it in the render method with
{ this.state.showViews && <Miniviews reducedArry={reducedArry} /> }
however, the value of Miniviews is actually not the returned objects from the function, but the object itself. The console.log outputs:
function Miniviews(_ref) {
var reducedArry = _ref.reducedArry;
Object.keys(reducedArry).map(function (applicationId) {
return _react2.default.createElement(
…
How can I make it return what I expect, which is:
<div id="1">
<Miniview />
<Miniview />
</div>
<div id="2">
<Miniview / >
</div>
[<>]toolbar button). Stack Snippets support React, including JSX; here's how to do one. That way, people helping you can see the problem actually happen, and can show you the fix working in their answers.