I have the following SSCCE in React using fixed-data-table:
const rows = [{name: 'Apple', desc: 'a popular fruit'},
{name: 'Cat', desc: 'a domesticated feline'}];
const App = React.createClass({
render: function() {
return (
<Table id='foo'
height={200}
width={400}
rowsCount={rows.length}
rowHeight={26}
headerHeight={50}>
<Column
width={0}
flexGrow={2}
cell={props=>(<Cell>{rows[props.rowIndex].name}</Cell>)}
header='Name'/>
<Column
width={0}
flexGrow={2}
cell={props=>(<Cell>{rows[props.rowIndex].desc}</Cell>)}
header='Description'/>
</Table>
);
}
});
The above works and renders both columns:
Now I am trying to create my own helper component to simplify the Column
interface:
const EnhancedColumn = React.createClass({
render: function() {
console.log('render called');
return (
<Column
width={0}
flexGrow={2}
cell={props=>(<Cell>{rows[props.rowIndex].name}</Cell>)}
header='Name'/>
);
}
});
const App2 = React.createClass({
render: function() {
return (
<Table id='foo'
height={200}
width={400}
rowsCount={rows.length}
rowHeight={26}
headerHeight={50}>
<EnhancedColumn/>
<Column
width={0}
flexGrow={2}
cell={props=>(<Cell>{rows[props.rowIndex].desc}</Cell>)}
header='Description'/>
</Table>
);
}
});
Suddenly the EnhancedColumn
is not rendered at all (in fact its render method is not even called as the message render is called
does not appear on the console):
I logged this as an issue.