Skip to content

Instantly share code, notes, and snippets.

@nhalstead
Created March 20, 2020 15:17
Show Gist options
  • Save nhalstead/1c4fc9b330409a02a3843d92d6d5516f to your computer and use it in GitHub Desktop.
Save nhalstead/1c4fc9b330409a02a3843d92d6d5516f to your computer and use it in GitHub Desktop.
Parent Child Relation
// 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