import React, { useState } from 'react'; import { FormControl, InputLabel, Select,…
- User
import React, { useState } from 'react'; import { FormControl, InputLabel, Select, MenuItem, SelectChangeEvent } from '@mui/material';
// Типизация пропсов компонента interface DropdownProps { options: string[]; label: string; defaultValue?: string; onChange?: (selectedValue: string) => void; }
const Dropdown: React.FC = ({ options, label, defaultValue = '', onChange }) => { const [selectedValue, setSelectedValue] = useState(defaultValue);
const handleChange = (event: SelectChangeEvent) => { const value = event.target.value; setSelectedValue(value); if (onChange) { onChange(value); } };
return ( {label} {options.map((option, index) => ( {option} ))} ); };
export default Dropdown;
- Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.