From c674e970df8fda6d8952e08c8e71ef6126a0b130 Mon Sep 17 00:00:00 2001 From: anlyyao Date: Thu, 17 Oct 2024 19:44:46 +0800 Subject: [PATCH] fix(Checkbox): fix console warning --- src/checkbox/Checkbox.tsx | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/checkbox/Checkbox.tsx b/src/checkbox/Checkbox.tsx index 031a4217..1047523a 100644 --- a/src/checkbox/Checkbox.tsx +++ b/src/checkbox/Checkbox.tsx @@ -29,7 +29,7 @@ export interface CheckContextValue { export const CheckContext = React.createContext(null); -const Checkbox = forwardRef((_props: CheckBoxProps) => { +const Checkbox = forwardRef((_props, ref) => { const context = useContext(CheckContext); const props = useDefaultProps(context ? context.inject(_props) : _props, checkboxDefaultProps); const { classPrefix } = useConfig(); @@ -167,22 +167,20 @@ const Checkbox = forwardRef((_props: CheckBoxProps) => { ); return ( - <> -
- {icon && renderIconNode()} - {renderCheckBoxContent()} - {/* 下边框 */} - {!borderless && ( -
- )} -
- +
+ {icon && renderIconNode()} + {renderCheckBoxContent()} + {/* 下边框 */} + {!borderless && ( +
+ )} +
); }); Checkbox.displayName = 'Checkbox'; export default forwardRefWithStatics( - (props: TdCheckboxProps, ref: Ref) => , + (props: TdCheckboxProps, ref: Ref) => , { Group: CheckboxGroup }, );