Skip to content

Commit 5c7eb82

Browse files
committed
♻️ Refactor ExampleCustomInput component for improved clarity
1 parent 145ad9c commit 5c7eb82

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

docs-site/src/examples/ts/customInput.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@ type ExampleCustomInputProps = {
44
onClick?: () => void;
55
};
66

7+
const ExampleCustomInput = forwardRef<
8+
HTMLButtonElement,
9+
ExampleCustomInputProps
10+
>(({ value, onClick, className }, ref) => (
11+
<button type="button" className={className} onClick={onClick} ref={ref}>
12+
{value}
13+
</button>
14+
));
15+
ExampleCustomInput.displayName = "ExampleCustomInput";
16+
717
const CustomInput = () => {
818
const [selectedDate, setSelectedDate] = useState<Date | null>(new Date());
919

10-
const ExampleCustomInput = forwardRef<
11-
HTMLButtonElement,
12-
ExampleCustomInputProps
13-
>(({ value, onClick, className }, ref) => (
14-
<button className={className} onClick={onClick} ref={ref}>
15-
{value}
16-
</button>
17-
));
18-
1920
return (
2021
<DatePicker
2122
selected={selectedDate}

0 commit comments

Comments
 (0)