Created
March 1, 2021 21:44
-
-
Save nafeu/460ac485ec00ae2338ac83d70099c6fe to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return existingRows.map((row, index) => { | |
const isMatchedRowWithSubRows = index === Number(id) && row.subRows; | |
if (isMatchedRowWithSubRows) { | |
const [, ...updatedPath] = path; | |
return { | |
...row, | |
subRows: insertIntoTable({ | |
existingRows: row.subRows, | |
subRowsToInsert, | |
path: updatedPath | |
}) | |
} | |
} | |
return row; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment