Skip to content

Commit fbf0057

Browse files
committed
[#102] ♻️ remove duplicated state control
1 parent 5facfa7 commit fbf0057

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/components/shared/select/Select.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,11 @@ export const Select = ({
2525
placeholder = 'Select an option',
2626
disabled = false,
2727
}: SelectProps): JSX.Element => {
28-
const [selectedLabel, setSelectedLabel] = useState(
29-
options.find(option => option.value === value)?.label || ''
30-
)
28+
const selectedOption = options.find(option => option.value === value)
29+
const selectedLabel = selectedOption?.label || ''
3130

32-
const handleSelect = (value: string, label: string) => {
31+
const handleSelect = (value: string) => {
3332
onChange(value)
34-
setSelectedLabel(label)
3533
}
3634

3735
const triggerStyle = clsx({

0 commit comments

Comments
 (0)