feat: CarBodySelect initial value
This commit is contained in:
parent
fd79ab4e72
commit
b719006c79
@ -18,7 +18,9 @@ import { CarBodySelectOption } from './types';
|
|||||||
|
|
||||||
export const CarBodySelect = forwardRef<HTMLInputElement, InputProps>(
|
export const CarBodySelect = forwardRef<HTMLInputElement, InputProps>(
|
||||||
function CarBodySelect(props, ref) {
|
function CarBodySelect(props, ref) {
|
||||||
const [selected, setSelected] = useState<Partial<CarBodySelectOption>>({});
|
const initialOption = carBodySelectOptions.find(({ value }) => value === Number(props.value));
|
||||||
|
const [selected, setSelected] = useState<Partial<CarBodySelectOption>>(initialOption);
|
||||||
|
|
||||||
const handleOptionClick = (option: CarBodySelectOption) => {
|
const handleOptionClick = (option: CarBodySelectOption) => {
|
||||||
setSelected(option);
|
setSelected(option);
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
Loading…
Reference in New Issue
Block a user