Created
March 20, 2020 15:17
-
-
Save nhalstead/1c4fc9b330409a02a3843d92d6d5516f to your computer and use it in GitHub Desktop.
Parent Child Relation
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
// Link to the Child via a Child List (Parent Has the Children) aka Looking Down | |
parentChildData={(currentRow, allRows) => allRows.find(entry => _.find(entry.childQuestions, childEntry => childEntry.childQuestion.childQuestionId === currentRow.id))} | |
// Link to the Child via a Parant List (Child Has the Parents) aka Looking Up | |
parentChildData={(currentRow, allRows) => currentRow.parentQuestions[0] !== undefined && _.find(allRows, rowEntry => rowEntry.id === currentRow.parentQuestions[0].childQuestion.parentQuestionId)} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment