fix: removing unneeded React.Fragment

This commit is contained in:
David Joy
2021-04-06 12:20:18 -04:00
parent 1beb96d958
commit c5e42cdf79

View File

@@ -8,47 +8,45 @@ import messages from './messages';
function FeaturesTable({ apps, features, intl }) {
return (
<>
<DataTable
itemCount={features.length}
data={features.map(feature => {
const appCheckmarkCells = {};
// DataTable wants 'data' to be an array of objects where each property of an object
// represents a cell in that row, identified by its key.
apps.forEach(app => {
// If our app's set of feature Ids includes this feature, return a checkmark.
// i.e, if this app has the current feature, check it!
appCheckmarkCells[app.id] = app.featureIds.includes(feature.id) ? (
<div key={`${app.id}&${feature.id}`}>
<FontAwesomeIcon icon={faCheck} />
</div>
) : null;
});
<DataTable
itemCount={features.length}
data={features.map(feature => {
const appCheckmarkCells = {};
// DataTable wants 'data' to be an array of objects where each property of an object
// represents a cell in that row, identified by its key.
apps.forEach(app => {
// If our app's set of feature Ids includes this feature, return a checkmark.
// i.e, if this app has the current feature, check it!
appCheckmarkCells[app.id] = app.featureIds.includes(feature.id) ? (
<div key={`${app.id}&${feature.id}`}>
<FontAwesomeIcon icon={faCheck} />
</div>
) : null;
});
return {
feature: intl.formatMessage(messages[`featureName-${feature.id}`]), // 'feature' is the identifier for cells in the first column.
// This is spreading the app IDs from appCheckmarkCells into the return array, creating
// one object with 'feature' and the app.id keys from above. The values are the JSX
// above with the font awesome checkmarks in 'em
...appCheckmarkCells,
};
})}
columns={[
{
Header: '',
accessor: 'feature',
},
// We're converting our apps array into a bunch of objects with "Header" and "accessor"
// keys, like DataTable expects.
...apps.map(app => ({
Header: intl.formatMessage(messages[`appName-${app.id}`]),
accessor: app.id,
})),
]}
>
<DataTable.Table />
</DataTable>
</>
return {
feature: intl.formatMessage(messages[`featureName-${feature.id}`]), // 'feature' is the identifier for cells in the first column.
// This is spreading the app IDs from appCheckmarkCells into the return array, creating
// one object with 'feature' and the app.id keys from above. The values are the JSX
// above with the font awesome checkmarks in 'em
...appCheckmarkCells,
};
})}
columns={[
{
Header: '',
accessor: 'feature',
},
// We're converting our apps array into a bunch of objects with "Header" and "accessor"
// keys, like DataTable expects.
...apps.map(app => ({
Header: intl.formatMessage(messages[`appName-${app.id}`]),
accessor: app.id,
})),
]}
>
<DataTable.Table />
</DataTable>
);
}