我在checked
抛出以下错误的情况下遇到了这个问题:
`No overload matches this call.
Overload 1 of 2, '(props: CheckboxProps, context?: any): ReactElement<any, any> | Component<CheckboxProps, any, any> | null', gave the following error.
Type 'Boolean' is not assignable to type 'boolean | undefined'.
Type 'Boolean' is not assignable to type 'true'.
Overload 2 of 2, '(props: PropsWithChildren<CheckboxProps>, context?: any): ReactElement<any, any> | Component<CheckboxProps, any, any> | null', gave the following error.
Type 'Boolean' is not assignable to type 'boolean | undefined'.
Type 'Boolean' is not assignable to type 'true'.`
<CheckboxDiv>
<Checkbox
onChange={() => dispatch(switchCompleted())}
checked={status.showCompleted}
style={{
color: "#262626",
}}
classes={{ root: "custom-checkbox-root" }}
/>
</CheckboxDiv>
,我不知道它是否会更改某些内容,但是我还定义了index.html
文件上的复选框的大小。看起来像这样:
<style>
.custom-checkbox-root .MuiSvgIcon-root {
width: 2.1rem;
height: 2.1rem;
}
</style>