mirror of
https://github.com/ershisan99/DevToysWeb.git
synced 2025-12-17 20:49:24 +00:00
refactor: memoize input and textarea on export
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import * as React from "react";
|
||||
import equal from "react-fast-compare";
|
||||
|
||||
import { cn } from "@/lib/style";
|
||||
|
||||
export type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>;
|
||||
|
||||
export const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
||||
export const RawTextarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
||||
({ className, ...props }, ref) => (
|
||||
<textarea
|
||||
{...{ ref }}
|
||||
@@ -17,4 +18,6 @@ export const Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(
|
||||
/>
|
||||
)
|
||||
);
|
||||
Textarea.displayName = "Textarea";
|
||||
RawTextarea.displayName = "RawTextarea";
|
||||
|
||||
export const Textarea = React.memo(RawTextarea, equal);
|
||||
|
||||
Reference in New Issue
Block a user