Open
Description
This came up in a conversation on Gitter. The ListView does not have any methods to manipulate rows, only set them ( setRows()
).
Solution:
addRow: row => state => ({rows: [...state.rows, row]}),
removeRowByIndex: index => state => {
const rows = state.rows;
if (index >= 0) {
rows.splice(index, 1)
}
return {rows}
},
removeRow: row => (state, actions) => {
const foundIndex = rows.findIndex(r => r === row);
return actions.removeRowByIndex(foundIndex);
}