21 lines
373 B
TypeScript
21 lines
373 B
TypeScript
"use client";
|
|
|
|
import type { ComponentProps } from "react";
|
|
|
|
type AutoSubmitSelectProps = ComponentProps<"select">;
|
|
|
|
export function AutoSubmitSelect({
|
|
onChange,
|
|
...props
|
|
}: AutoSubmitSelectProps) {
|
|
return (
|
|
<select
|
|
{...props}
|
|
onChange={(event) => {
|
|
onChange?.(event);
|
|
event.currentTarget.form?.requestSubmit();
|
|
}}
|
|
/>
|
|
);
|
|
}
|