Skip to content

Commit

Permalink
Ensure we use unique React keys in the multi-select component (#410)
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelmale authored Oct 11, 2024
1 parent 4bca1cb commit 810fd93
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/inputs/multi-select/multi-select.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const MultiSelect: React.FC<FormFieldInputProps> = ({ field, value, errors, warn
initialSelectedItems={initiallySelectedQuestionItems}
label={''}
titleText={label}
key={counter}
key={field.id}
itemToString={(item) => (item ? item.label : ' ')}
disabled={field.isDisabled}
invalid={errors.length > 0}
Expand All @@ -118,10 +118,10 @@ const MultiSelect: React.FC<FormFieldInputProps> = ({ field, value, errors, warn
{field.questionOptions.answers?.map((value, index) => {
return (
<Checkbox
key={value.concept}
key={`${field.id}-${value.concept}`}
className={styles.checkbox}
labelText={value.label}
id={value.concept}
id={`${field.id}-${value.concept}`}
onChange={() => {
handleSelectCheckbox(value);
}}
Expand Down

0 comments on commit 810fd93

Please sign in to comment.