Skip to content

Commit 779f84f

Browse files
committed
fix(dropdown): remove redundant selected prop from option elements
1 parent 324a1ee commit 779f84f

1 file changed

Lines changed: 1 addition & 10 deletions

File tree

src/components/dropdown.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,14 @@ export const KeyValueDropdownComponent: React.FC<DropdownProps> = ({
2424
}
2525
};
2626

27-
const current = defaultValue
28-
? options.find((option) => option.value === defaultValue)?.label
29-
: "";
30-
3127
return (
3228
<div>
33-
{/* defaultValue={current} doesn't work */}
3429
<select value={defaultValue} onChange={handleChange}>
3530
{options.map((option) => (
36-
<option
37-
key={option.value}
38-
value={option.value}
39-
selected={option.label == current}>
31+
<option key={option.value} value={option.value}>
4032
{option.label}
4133
</option>
4234
))}
43-
;
4435
</select>
4536
</div>
4637
);

0 commit comments

Comments
 (0)